centos6安装mysql5.6.19,升级到5.6.48
以下为在root用户下安装mysql5.6.19,然后升级到5.6.48的过程,在root下操作非常简单,且都是5.6系列只要简单执行rpm -ivh进行安装,rpm -Uvh 进行升级既可,5.6只需要安装client包和service。mysql5.7系列和非root下的安装、升级,后续会说到。
软件下载地址:https://downloads.mysql.com/archives/community/
软件下载地址2:http://ftp.ntu.edu.tw/MySQL/Downloads/
地址2下载时注意版本,el6代表redhat6系列,el7代表redhat7系列。
[[email protected] soft_rpm]# rpm -qa|grep -i mara* #有就卸载
[[email protected] soft_rpm]# rpm -qa|grep -i mysql #有就卸载
mysql-libs-5.1.73-8.el6_8.x86_64
[[email protected] soft_rpm]# rpm -e mysql-libs-5.1.73-8.el6_8.x86_64 --nodeps
[[email protected] mysql5.6.19]# ls
MySQL-5.6.19-1.el6.x86_64.rpm-bundle.tar
[[email protected] mysql5.6.19]# tar -xf MySQL-5.6.19-1.el6.x86_64.rpm-bundle.tar
[[email protected] mysql5.6.19]# rpm -ivh MySQL-server-5.6.19-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
.....................
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! #注意这两句话,告诉你默认密码放在哪
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
[[email protected] mysql5.6.19]# rpm -ivh MySQL-client-5.6.19-1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[[email protected] init.d]# service mysql start
Starting MySQL.. SUCCESS!
[[email protected] mysql5.6.19]# cat /root/.mysql_secret
# The random password set for the root user at Tue Dec 3 10:30:44 2019 (local time): HWwdfKQHfkRRCsGn
mysql> set password for [email protected]=password('root');
Query OK, 0 rows affected (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.19 |
+-----------+
1 row in set (0.02 sec)
[[email protected] mysql5.6.19]# service mysql stop
Shutting down MySQL.. SUCCESS!
[[email protected] mysql5.6.46]# tar -xf MySQL-5.6.46-1.el6.x86_64.rpm-bundle.tar
[[email protected] mysql5.6.46]# ls
MySQL-5.6.46-1.el6.x86_64.rpm-bundle.tar MySQL-devel-5.6.46-1.el6.x86_64.rpm MySQL-server-5.6.46-1.el6.x86_64.rpm MySQL-shared-compat-5.6.46-1.el6.x86_64.rpm
MySQL-client-5.6.46-1.el6.x86_64.rpm MySQL-embedded-5.6.46-1.el6.x86_64.rpm MySQL-shared-5.6.46-1.el6.x86_64.rpm MySQL-test-5.6.46-1.el6.x86_64.rpm
[[email protected] mysql5.6.46]# rpm -Uvh MySQL-server-5.6.46-1.el6.x86_64.rpm
[[email protected] mysql5.6.46]# rpm -Uvh MySQL-client-5.6.46-1.el6.x86_64.rpm
[[email protected] mysql5.6.46]# mysql_upgrade -uroot -proot -s
[[email protected] init.d]# service mysql start
Starting MySQL.. SUCCESS!
[[email protected] init.d]# mysql -uroot -proot
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.46 |
+-----------+
1 row in set (0.00 sec)