1、安装部署
a)安装: yum install -y mysql-server b)启动mysql: /etc/init.d/mysqld start c)设置用户名密码: /usr/bin/mysqladmin -u root password '123456' d)使用root登录: mysql -uroot -p123456 Mysql命令 查看数据库列表 show databases; 查看数据表 show tables; 数据库切换 use 数据库名2、解决中文乱码
1、使用root登录:mysql -uroot -p123456 2、查看当前编码集:show variables like 'character_set_%'; 3、修改配置/etc/my.cnf,在/etc/my.cnf中添加以下内容: [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] character-set-server=utf8 4、重启mysql:/etc/init.d/mysqld restart3、解决mysql远程连接失败
远程连接工具连接mysql报错如下 原因:mysql允许远程连接的服务器收到限制修改mysql配置:
A: mysql -uroot -p123456 B: mysql> use mysql C: select host,user ,password from user; D: 修改远程限制,让root用户在任意节点使用123456都能够访问 grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; E: 刷新配置 flush privileges; F: 查看最终结果 select host, user ,password from user; G:再次连接