mysql安装笔记
** 原装版本报错
在装操作系统的时候,默认安装了mysql,但是却有报错:
[root@STCJ mysql-software]# mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
解决办法:由于原版本过低,这里卸载原版本,重新安装全新的mysql
** 版本冲突问题
[root@STCJ mysql-software]# rpm -e mysql-server-5.0.77-3.el5.x86_64
在卸载源版本时,会出现依赖问题,需要顺次卸载(详见下面的“版本冲突解决列表”)
** 安装server
[root@STWEB mysql]# rpm -ivh MySQL-server-5.1.26-0.glibc23.i386.rpm
** 安装client
[root@STWEB mysql]# rpm -ivh MySQL-client-5.1.26-0.glibc23.i386.rpm
** mysql安全设置
+ [root@STWEB usr]# /usr/bin/mysql_secure_installation
+ root用户设置密码
+ 取消默认账户
+ 创建新账户、密码、赋权(本地权限、远程权限)
**
**
-----------------------------------版本冲突解决列表----------------------------------------
* 安装server
[root@STCJ mysql-software]# rpm -ivh MySQL-server-5.1.26-0.glibc23.i386.rpm
error: Failed dependencies:
MySQL conflicts with mysql-5.0.77-3.el5.x86_64
MySQL conflicts with mysql-5.0.77-3.el5.i386
MySQL-server conflicts with mysql-server-5.0.77-3.el5.x86_64
* 查看冲突文件
[root@STWEB local]# rpm -qa|grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mod_auth_mysql-3.0.0-3.2.el5_3
mysql-5.0.77-3.el5
php-mysql-5.1.6-23.2.el5_3
mysql-server-5.0.77-3.el5
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-devel-5.0.77-3.el5
mysql-5.0.77-3.el5
mysql-devel-5.0.77-3.el5
mysql-bench-5.0.77-3.el5
* 卸载依赖冲突
[root@STCJ mysql-software]# rpm -e mysql-server-5.0.77-3.el5.x86_64
[root@STCJ mysql-software]# rpm -ivh MySQL-server-5.1.26-0.glibc23.i386.rpm
error: Failed dependencies:
MySQL conflicts with mysql-5.0.77-3.el5.x86_64
MySQL conflicts with mysql-5.0.77-3.el5.i386
[root@STCJ mysql-software]# rpm -e mysql-5.0.77-3.el5.x86_64
error: Failed dependencies:
libmysqlclient.so.15()(64bit) is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) libdbi-dbd-mysql-0.8.1a-1.2.2.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) mysql-connector-odbc-3.51.26r1127-1.el5.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) qt-MySQL-3.3.6-23.el5.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) php-mysql-5.1.6-23.2.el5_3.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) mysql-devel-5.0.77-3.el5.x86_64
libmysqlclient.so.15()(64bit) is needed by (installed) mod_auth_mysql-3.0.0-3.2.el5_3.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) libdbi-dbd-mysql-0.8.1a-1.2.2.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) mysql-connector-odbc-3.51.26r1127-1.el5.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) qt-MySQL-3.3.6-23.el5.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) php-mysql-5.1.6-23.2.el5_3.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) mod_auth_mysql-3.0.0-3.2.el5_3.x86_64
libmysqlclient_r.so.15()(64bit) is needed by (installed) MySQL-python-1.2.1-1.x86_64
libmysqlclient_r.so.15()(64bit) is needed by (installed) mysql-connector-odbc-3.51.26r1127-1.el5.x86_64
libmysqlclient_r.so.15()(64bit) is needed by (installed) mysql-devel-5.0.77-3.el5.x86_64
libmysqlclient_r.so.15(libmysqlclient_15)(64bit) is needed by (installed) MySQL-python-1.2.1-1.x86_64
libmysqlclient_r.so.15(libmysqlclient_15)(64bit) is needed by (installed) mysql-connector-odbc-3.51.26r1127-1.el5.x86_64
* 继续卸载依赖冲突
rpm -e perl-DBD-MySQL-3.0007-2.el5.x86_64
rpm -e libdbi-dbd-mysql-0.8.1a-1.2.2.x86_64
rpm -e mysql-connector-odbc-3.51.26r1127-1.el5.x86_64
rpm -e qt-MySQL-3.3.6-23.el5.x86_64
rpm -e mysql-devel-5.0.77-3.el5.x86_64
rpm -e mod_auth_mysql-3.0.0-3.2.el5_3.x86_64
rpm -e MySQL-python-1.2.1-1.x86_64
rpm -e php-mysql-5.1.6-23.2.el5_3.x86_64
* 完成一次卸载
[root@STCJ mysql-software]# rpm -e mysql-5.0.77-3.el5.x86_64
[root@STCJ mysql-software]# rpm -e mysql-5.0.77-3.el5.i386
error: Failed dependencies:
libmysqlclient.so.15 is needed by (installed) mysql-devel-5.0.77-3.el5.i386
libmysqlclient_r.so.15 is needed by (installed) mysql-devel-5.0.77-3.el5.i386
mysql = 5.0.77-3.el5 is needed by (installed) mysql-bench-5.0.77-3.el5.x86_64
mysql = 5.0.77-3.el5 is needed by (installed) mysql-devel-5.0.77-3.el5.i386
* 继续卸载依赖冲突
rpm -e mysql-devel-5.0.77-3.el5.i386
rpm -e mysql-bench-5.0.77-3.el5.x86_64
[root@STCJ mysql-software]# rpm -e mysql-5.0.77-3.el5.i386
[root@STCJ mysql-software]# rpm -ivh MySQL-server-5.1.26-0.glibc23.i386.rpm
启动成功提示
* 安装client
[root@STCJ mysql-software]# rpm -ivh MySQL-client-5.1.26-0.glibc23.i386.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]