1.下载并安装MySQL
命令:wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum localinstall mysql80-community-release-el7-1.noarch.rpm
2.安装mysql
命令: yum install mysql-community-server
3.启动
命令:systemctl start mysqld
4.查看启动状态
命令:systemctl status mysqld
5.修改密码
1)查看原始密码:
命令:grep 'temporary password' /var/log/mysqld.log
2)登录本地mysql
命令:mysql -uroot -p
输入原密码;
3)修改密码
命令:ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
注意新密码要复杂一点,不然会报错;
6.添加远程登录用户
1)查看当前用户的权限
命令:use mysql;
select host, user from user;
2)授权root可以远程访问
命令:GRANT ALL ON *.* TO 'root'@'%';
如果报错用下面的命令
命令:update user set host='%' where user ='root';
网友评论