Centos7安装MySql5.7版本
安装
-
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
-
yum -y install mysql57-community-release-el7-10.noarch.rpm
-
yum -y install mysql-community-server
启动Mysql服务
systemctl start mysqld.service
查看运行状态
systemctl status mysqld.service
查看默认密码
grep "password" /var/log/mysqld.log
用户登录
mysql -uroot -p
修改用户密码
set password for [user]@localhost = password('[password]');
- user : 允许远程登录的用户
- password:该用户的密码
注意:密码必须大写字母数字结合,不然会设置不成功。
设置远程登录
GRANT ALL PRIVILEGES ON *.* TO '[user]'@'%'IDENTIFIED BY '[password]' WITH GRANT OPTION;
- user : 允许远程登录的用户
- password:该用户的密码
FLUSH PRIVILEGES