MYSQL安装方法

MYSQL安装方法:

1
2
3
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

查看状态和启动:

1
2
3
4
5
6
7
systemctl start  mysqld.service 
systemctl status 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 'root';

因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉

1
yum -y remove mysql57-community-release-el7-10.noarch              

修改远程登录

1
2
3
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

FLUSH PRIVILEGES;

查看IP地址

1
curl ifconfig.me  

MySql8的处理方式:

1
2
3
4
5
6
7
lower_case_table_names=1
# 允许弱密码
set global validate_password.policy = 0;
# 密码最短长度为1
set global validate_password.length = 1;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Mx@12qwas';``