1.下载yum源:
wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'
2.安装yum源
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
3.查看有哪些版本的mysql
yum repolist all | grep mysql
4.安装
yum install -y mysql-community-server
5.命令
启动:systemctl start mysqld
停止:systemctl stop mysqld
查看状态:systemctl status mysqld
6.查看默认密码
grep 'temporary password' /var/log/mysqld.log
7.修改密码
SET PASSWORD = PASSWORD('Admin123!');
8.设置远程可以登录
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'Admin123!' WITH GRANT OPTION;
GRANT 【权限内容】 ON 【库名】.【表名】 TO 【用户名】@'【IP地址】' IDENTIFIED BY '【密码】' WITH GRANT OPTION;
8.常用命令
mysql -u root -p 连接数据库
网友评论