CentOS7 安装MySQL
2020-04-04 本文已影响0人
GCAmEmFG
下载:
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
安装:
yum -y install mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server
开启服务
systemctl start mysqld.service
获取临时密码:
grep "password" /var/log/mysqld.log
设置密码:
先用临时密码登陆
mysql -uroot -p
->mysql set global validate_password.policy=0;
->mysql set global validate_password.length=1;
再设置自己的密码
->mysql alter user 'root'@'localhost' identified by '123456';
开启远程访问:( mysql默认不允许远程登录,所以需要开启远程访问权限 )
mysql -uroot -p
->mysql use mysql;
->mysql select user,authentication_string,host from user;
->mysql update user set host = '%' where user = 'root';
->mysql FLUSH PRIVILEGES;
->mysql alter user 'root'@'%' identified with mysql_native_password by '123456';