1 下载 MySQL Yum Repository
地址:https://dev.mysql.com/downloads/repo/yum/
安装指令:sudo rpm -Uvh platform-and-version-specific-package-name.rpm
2 安装安装版本
修改文件/etc/yum.repos.d/mysql-community.repo
指令:vim /etc/yum.repos.d/mysql-community.repo
实例:
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
3安装mysql
安装指令:sudo yum install mysql-community-server
4 启动mysql
指令:sudo systemctl status mysqld.service
5 查看默认密码
指令:sudo grep 'temporary password' /var/log/mysqld.log
连接数据:mysql -uroot -p
修改密码策略,允许弱密码,指令:SET GLOBAL validate_password_policy='LOW';
密码长度策略,指令:SET GLOBAL validate_password_length=4;
修改新密码:set password ="newpassword"
6 用户操作
新增create user
username@
%identified by'123456';
删除:drop user '用户名'@'IP地址';
修改:rename user '用户名'@'IP地址' to '新用户名'@'IP地址';
修改密码:set password for '用户名'@'IP地址' = Password('新密码');
网友评论