Linux安装mysql数据库
这里写自定义目录标题
mysql安装
1.在服务器是通网的状态下,安装下载工具
执行yum install wget
2. wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm下载mysql
3.安装yum源
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
4.检查yum源是否安装成功
命令:yum repolist enabled | grep “mysql.-community.”
5.安装mysql yum -y install mysql-community-server
6.启动mysql systemctl start mysqld.service
查看mysql状态 systemctl status mysqld.service
获取mysql root密码 grep “password” /var/log/mysqld.log
7.登录mysql命令 mysql -u root -p
8.修改root密码 ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘1qaz!QAZ’;
9.查看密码要求:SHOW VARIABLES LIKE ‘validate_password%’;
设置密码强度: set global validate_password_policy=LOW; (LOW,MEDIUM ,STRONG)
设置密码长度: set global validate_password_length=6;
10.给予远程登录权限
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘1234’;
此时表示已有root的远程连接权限 %表示所有主机。
最后本地连接测试