1、安装 MySQL-5.7.36
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.36-1.el6.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.36-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.36-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.36-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.36-1.el6.x86_64.rpm
2、启动服务
service mysqld start
service mysqld status
3、服务启动后,会自动创建'root'@'localhost'账号,并生成临时密码,临时密码的获取方式:
grep 'temporary password' /var/log/mysqld.log
4、修改账户密码
mysql -u root -p2_Yoxk%Dqli4
ALTER USER 'root'@'localhost' IDENTIFIED BY '2_Yoxk%Dqli4';
5、创建远程访问账户并授权
create user 'root'@'%' IDENTIFIED BY '2_Yoxk%Dqli4';
grant all on *.* to 'root'@'%';
flush PRIVILEGES;
文章评论