5-28 2,741 views
参考:http://www.koukousky.com/back/1296.html
参考:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
$ wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
$ rpm -Uvh mysql80-community-release-el7-3.noarch.rpm --force --nodeps
#设置mysql版本为5.7
$ vim /etc/yum.repos.d/mysql-community.repo
[mysql56-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1 #指定版本
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
#把mysql8.0的enabled改成0,如果要安装8.0就不改
$ yum install mysql mysql-server mysql-devel mysql-bench mysql-common mysql-devel mysql-libs
#启动
$ systemctl start mysqld.service
#开机启动
$ systemctl enable mysqld.service
#查看默认创建的root密码
#$ grep 'temporary password' /var/log/mysqld.log
$ mysql -uroot -p
#修改roomt密码,MySQL的 validate_password 插件默认安装。这将要求密码包含至少一个大写字母,一个小写字母,一个数字和一个特殊字符,并且密码总长度至少为8个字符。
##5.7
$ SET PASSWORD = PASSWORD('your_new_password');
##5.6
$ UPDATE mysql.user SET Password=PASSWORD('xxxxxx') WHERE User='root';
$ flush privileges;
添加外网developer用户
#此用户拥有所有数据库的所有操作权限,所以不用这个用户的时候可以把3306端口关掉,防止被攻击。
$ grant all privileges on *.* to developer@'%' identified by 'you password';
flush privileges;