InJavaWeTrust 2020-01-28
0、先将原先的MySQL卸载
1、先将安装包放到/opt/software/mysql/下
2、解压
unzip mysql-connector-java-5.1.27.tar.gz
3、安装服务端
sudo rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm
4、安装客户端
sudo rpm -ivh MySQL-client-5.6.24-1.el6.x86_64.rpm
5、启动MySQL服务
sudo service mysql start
6、查看初始密码
sudo cat /root/.mysql_secret
7、使用初始密码登录MySQL
mysql -uroot -pykOCjZ0ML9KJd9qS
8、修改MySQL密码
mysql> set password = password('123');
9、退出MySQL,然后使用新密码重新登录
mysql> quit;
$ mysql -uroot -p123
10、修改root用户远程访问权限
? (1)使用mysql库
mysql> use mysql;
? (2)查看
mysql> select user,host from user;
+------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | root | ::1 | | root | hadoop106 | | root | localhost | +------+-----------+ 4 rows in set (0.00 sec)
? (3)把localhost改成%
mysql> update user set host='%' where host='localhost';
? (4)再次查询
mysql> select user,host from user;
+------+-----------+ | user | host | +------+-----------+ | root | % | | root | 127.0.0.1 | | root | ::1 | | root | hadoop106 | +------+-----------+ 4 rows in set (0.00 sec)
? (5)把其他的用户删除
mysql> delete from user where host!='%';
? (6)刷新
mysql> flush privileges;
? (7)安装完成
mysql> quit;