查看OS版本
[root@justin mysqldata]# more /etc/issue
Enterprise Linux Enterprise Linux AS release 4 (October Update 8)
卸载了已有的mysql
首先运行yum remove mysql
然后通过rpm –qa | grep mysql查看是否还有残余的Mysql插件,若有则通过以下命令删除
[root@justin oracle]# rpm -e mysqlclient10-3.23.58-4.RHEL4.1
error: "mysqlclient10-3.23.58-4.RHEL4.1" specifies multiple packages
[root@justin oracle]# rpm -e --allmatches mysqlclient10-3.23.58-4.RHEL4.1
error: Failed dependencies:
libmysqlclient.so.10()(64bit) is needed by (installed) MyODBC-2.50.39-25.RHEL4.1.x86_64
libmysqlclient.so.10()(64bit) is needed by (installed) qt-MySQL-3.3.3-16.el4.x86_64
[root@justin oracle]# rpm -e MyODBC-2.50.39-25.RHEL4.1.x86_64
[root@justin oracle]# rpm -e qt-MySQL-3.3.3-16.el4.x86_64
[root@justin oracle]# rpm -e --allmatches mysqlclient10-3.23.58-4.RHEL4.1
[root@justin oracle]# rpm -qa | grep mysql
安装MySQL-server-5.5.14-1.rhel5.x86_64.rpm一直报告缺失相应patch
[root@justin oracle]# rpm -ivh MySQL-server-5.5.14-1.rhel5.x86_64.rpm
warning: MySQL-server-5.5.14-1.rhel5.x86_64.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
error: Failed dependencies:
libc.so.6(GLIBC_2.4)(64bit) is needed by MySQL-server-5.5.14-1.rhel5.x86_64
rtld(GNU_HASH) is needed by MySQL-server-5.5.14-1.rhel5.x86_64
尝试yum install libc.so.6却又不成功,于是改为安装MySQL-server-5.5.14-1.linux2.6.x86_64.rpm和MySQL-client-5.5.14-1.linux2.6.x86_64.rpm,然而安装的时候却又遇到以下错误。
[root@justin oracle]# rpm -ivh MySQL-server-5.1.51-1.glibc23.x86_64.rpm
warning: MySQL-server-5.1.51-1.glibc23.x86_64.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
ERROR: 1136 Column count doesn't match value count at row 1
110719 18:08:15 [ERROR] Aborting
110719 18:08:15 [Note] /usr/sbin/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.
You can try to start the mysqld daemon with:
shell> /usr/sbin/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/bin/mysqlbug script!
费了一大堆力气,最后找到答案,原来的mysql信息没有卸载干净,只需要移除/var/lib/mysql即可解决。
通过rpm –ivh 先后安装MySQL-server-5.5.14-1.linux2.6.x86_64.rpm和MySQL-client-5.5.14-1.linux2.6.x86_64.rpm.
Mysql默认安装路径为根目录,而61上的根目录空间有限,需将其转移的/data目录
[root@justin oracle]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 20G 15G 4.5G 77% /
/dev/sda1 289M 25M 250M 10% /boot
/dev/sda5 681G 213G 434G 33% /data
none 63G 0 63G 0% /dev/shm
首先在/data目录下创建名为mysqldata的目录,然后chown –R mysql /data/mysqldata 和chgrp –R mysql /data/mysqldata 将其属主设置成mysql
然后停止mysql服务,执行service mysql stop;
将/var/lib/mysql目录下所有的文件迁移到新创建的/data/myqldata下,mv /var/lib/mysql /data/mysqldata;
修改配置文件/etc/my.conf:
#socket = /var/lib/mysql/mysql.sock—修改前
socket = /data/mysqldata/mysql/mysql.sock—修改后的值
修改/etc/rc.d/init.d/mysql:
if test -z "$datadir"
#datadir=/var/lib/mysql—修改前的值
datadir=/data/mysqldata/mysql—修改后的值
保存并退出
此时重启service mysql start,虽然能启动成功,却多出一条警告信息
[root@justin mysqldata]# service mysql start
/etc/init.d/mysql: line 71: /data/mysqldata/mysql: is a directory
Starting MySQL..[ OK ]
经查实,文件/etc/rc.d/init.d/myql中的记录 datadir=/data/mysqldata/mysql 等号后面多出一个空格,去除即可
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15480802/viewspace-702671/ ,如需转载,请注明出处,否则将追究法律责任。