shell> yum remove mysql Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-5.el6_6 will be erased --> Processing Dependency: mysql = 5.1.73-5.el6_6 for package: mysql-server-5.1.73-5.el6_6.x86_64 --> Running transaction check ---> Package mysql-server.x86_64 0:5.1.73-5.el6_6 will be erased --> Finished Dependency Resolution
Dependencies Resolved
===================================================================================== Package Arch Version Repository Size ===================================================================================== Removing: mysql x86_64 5.1.73-5.el6_6 @base 2.4 M Removing for dependencies: mysql-server x86_64 5.1.73-5.el6_6 @base 25 M
Installed size: 27 M Is this ok [y/N]: #卸载老版本的MySQL,默认会同时卸载掉对应的client端
#执行上面的安装部分...
#启动数据库可能会出现下面的错误 shell> service mysqld restart Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED]
shell> mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) #查看日志出现如下报错 #[ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade. #解决方法是重新初始化数据库 shell> rm -fr /var/lib/mysql shell> mysqld --initialize --user=mysql shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]