mysql环境安装
Linux下使用yum安装MySQL,以及启动、登录和远程访问MySQL数据库。
1、yum –y update 更新yum包
2、重启服务器 reboot
3、检查有木有安装php –v
4、rpm -qa | gerp mysql或者yum list installed | grep mysql
5、下载安装包rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
6、安装MySQL: yum install -y mysql-server
7、设置开机启动:systemctl enable mysqld.service
8、检查开机启动是否设置成功:systemctl list-unit-files | grep mysqld
mysqld.service enabled成功
9、设置开启服务:systemctl start mysqld.service
查看初始登录密码:grep 'temporary password' /var/log/mysqld.log
10、登录mysql:mysql -uroot –p
11、设置当前用户的密码:SET PASSWORD = PASSWORD('Abc123!_');
12、开启远程登录,授权登录:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'a123456!' WITH GRANT OPTION;(禁止使用弱口令)
口令强度查看SHOW VARIABLES LIKE 'validate_password%';
设置密码校验级别set global validate_password_policy=0;
设置字母个数限制set global validate_password_mixed_case_count=0;
设置密码数字个数限制set global validate_password_number_count=0;
设置特殊字符个数限制set global validate_password_special_char_count=0;
设置密码最低长度限制set global validate_password_length=3;
13、命令立即执行flush privileges;
14、重启mysql服务service mysqld restart