当前位置:Gxlcms > mysql > CentOS7安装和配置MySQL

CentOS7安装和配置MySQL

时间:2021-07-01 10:21:17 帮助过:22人阅读


 
1. 下载MySQL Yum Repository
 
2. 本地安装MySQL Yum Repository
sudo yum localinstall platform-and-version-specific-package-name.rpm
 
3. 安装MySQL
sudo yum -y install mysql-community-server
 
4. 查看root初始密码
sudo grep 'temporary password' /var/log/mysqld.log
 
5. 执行安全性设置
mysql_secure_installation
 
6.设置字符集
vi /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
character_set_server=utf8
 
7. 设置开机启动
chkconfig --levels 235 mysqld on
 
8. 关闭CentOS防火墙
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --permanent --zone=public --add-port=3306/udp
firewall-cmd --reload
 
9. 创建远程访问用户
CREATE USER 'bounter'@'%' IDENTIFIED BY '111111@Bounter';
GRANT SELECT,INSERT,UPDATE,DELETE ON *.* TO 'bounter'@'%';
flush privileges;
 
10. 启动和关闭MySQL服务
sudo service mysqld start
sudo service mysqld stop

以上就是CentOS7安装和配置MySQL的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行