转载自:https://codeday.me/collect/20170524/21861.html
1: 检测系统是否自带安装mysql
# yum list installed | grep mysql
2: 删除系统自带的mysql及其依赖命令:
# yum -y remove mysql-libs.x86_64
3: 给CentOS添加rpm源,并且选择较新的源命令:
# wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm # centos 7.0+ 版本改为 wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# yum localinstall mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql
# yum-config-manager --disable mysql55-community
# yum-config-manager --disable mysql56-community
# yum-config-manager --enable mysql57-community-dmr
# yum repolist enabled | grep mysql
注意:如提示 bash: yum-config-manager: command not found
执行命令 yum -y install yum-utils
安装就可以了
4:安装mysql 服务器命令:
# yum install mysql-community-server
5: 启动mysql命令:
# service mysqld start
6: 查看mysql是否自启动,并且设置开启自启动命令:
# chkconfig --list | grep mysqld
# chkconfig mysqld on
7: mysql安全设置命令:
# mysql_secure_installation
注意:mysql5.7 以上版本已经不用mysql_secure_installation命令初始化密码,初始密码保存在临时文件:/var/log/mysqld.log,可以用grep ‘temporary password’ /var/log/mysqld.log 查找
本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:CentOS 6.5以上版本安装mysql 5.7 完整版教程(修订版)