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 all
yum makecache
 
#开始安装MySQL
yum install mysql-community-server
 
#启动MySQL
systemctl start mysqld
 
#启动成功后可以查看初始化密码随机生成的
cat /var/log/mysqld.log | grep password
 
#登录MySQL修改mysql用户密码
mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
#远程设置
mysql> use mysql;
mysql> update user set host='%' where user='root';
#授权用户名的权限,赋予任何主机访问数据的权限
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES; 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

open