CentOS 6.9安装MySQL5.5
默认CentOS 6.x安装有MySQL5.1,这里将其替换为MySQL5.5,相关步骤如下:
1、查看当前CentOS安装的MySQL情况:
rpm -qa | grep -i mysql
2、卸载MySQL,可以通过rpm -ev package 方式进行卸载,以下通过yum:
yum remove mysql*
3、删除遗留文件
rm -rf /var/lib/mysql
rm /etc/my.cnf
5、下载MySQL5.5.58包(MySQL-5.5.58-1.el6.x86_64.rpm-bundle.tar),解压:
mkdir /tmp/mysql
tar -xvf MySQL-5.5.58-1.el6.x86_64.rpm-bundle.tar -C /tmp/mysql
6、安装rpm,可以通过rpm -Uvh package安装,下面通过yum安装
yum localinstall MySQL-server-5.5.58-1.el6.x86_64.rpm
yum localinstall MySQL-devel-5.5.58-1.el6.x86_64.rpm
yum localinstall MySQL-client-5.5.58-1.el6.x86_64.rpm
yum localinstall MySQL-shared-compat-5.5.58-1.el6.x86_64.rpm
7、启动MySQL
/etc/init.d/mysql start
设置每次开机启动
chkconfig --levels 345 mysqld on
8、设置安全信息
/usr/bin/mysql_secure_installation
9、测试登录
mysql -u root -p密码