1: 检测系统是否自带安装mysql
#yum list installed | grep mysql
2: 删除系统自带的mysql及其依赖 命令:
#yum -y remove mysql-libs.x86_64
3: 给CentOS添加rpm源,并且选择较新的源命令,逐条执行,需要输入y的地方要注意输入:
#wget dev.mysql.com/get/mysql-community-release-el6-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
ps如果报错
-bash: yum-config-manager: command not found
有命令库没装,运行:yum install yum-utils
后续问号敲 y
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 如果到这一步要你输入密码你输入空却进不去就继续输入下面的命令
service mysqld stop
mysqld_safe --skip-grant-tables & mysql -uroot -p
> 敲回车 第一次默认为空
> use mysql;
>update mysql.user set authentication_string=password('避免后续麻烦密码必须包括至少两种数字母 或者直接为空') where user='root';
> flush privileges;
> quit
`
`
`
好了,看完记得点赞~~~