系统
CentOS 7.4
安装软件
MySQL8.0.11
下载MySQL yum源
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
安装yum源
yum localinstall mysql80-community-release-el7-1.noarch.rpm
更新yum源
yum clean allyum makecache
创建Mysql账户
groupadd mysqluseradd -g mysql mysql
开始安装MySQL
yum install mysql-community-server
启动MySQL
systemctl start mysqld
查看初始化密码
cat /var/log/mysqld.log | grep password
登录MySQL
mysql -u root -p
修改初始化密码(密码一定要大小写字母+数字+符号,如:Aa-123456789)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
远程设置
设置允许所有Ip访问主机
use mysql; update user set host='%' where user='root';
允许任何主机访问数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;FLUSH PRIVILEGES;