时间:2021-07-01 10:21:17 帮助过:3人阅读
a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)
1 |
[root@localhost
~] #
rpm -qa | grep -i mysql |
2 |
mysql-libs-5.1.66-2.el6_3.x86_64 |
3 |
[root@localhost
~] #
yum -y remove mysql-libs* |
b. 下载Linux对应的RPM包,如:CentOS6.6_64对应的RPM包,如下:
1 |
[root@localhost
rpm] #
ll |
2 |
total
74364 |
3 |
-rw-r--r--.
1 root root 18442536 Dec 11 16:43 MySQL-client-5.6.30-1.linux_glibc2.5.x86_64.rpm |
4 |
-rw-r--r--.
1 root root 3340660 Dec 11
16:43 MySQL-devel-5.6.30-1.linux_glibc2.5.x86_64.rpm |
5 |
-rw-r--r--.
1 root root 54360600 Dec 11
16:43 MySQL-server-5.6.30-1.linux_glibc2.5.x86_64.rpm |
c. 安装MySQL
1 |
[root@localhost
rpm] #
rpm -ivh MySQL-server-5.6.30-1.linux_glibc2.5.x86_64.rpm |
2 |
[root@localhost
rpm] #
rpm -ivh
MySQL-devel-5.6.30-1.linux_glibc2.5.x86_64.rpm |
3 |
[root@localhost
rpm] #
rpm -ivh
MySQL-client-5.6.30-1.linux_glibc2.5.x86_64.rpm |
4 |
#修改配置文件位置 |
5 |
[root@localhost
rpm] #
cp /usr/share/mysql/my-default.cnf /etc/my.cnf |
d. 初始化MySQL及设置密码
1 |
[root@localhost
rpm] #
/usr/bin/mysql_install_db |
2 |
[root@localhost
rpm] #
service mysql start |