版本格式是rpm包,linux redhat 5的操作系统,mysql版本为5.5,在之前装过5.0,但是已经卸载了。
出错如下:
[root@localhost opt]# rpm -ivh MySQL-server-5.5.28-1.rhel5.i386.rpm
Preparing...
########################################### [100%]
ls: /var/lib/mysql/*.err: No such file or directory
ls: /var/lib/mysql/*.err: No such file or directory
1:MySQL-server ########################################### [100%]
/var/lib/mysql/这个目录存在,且权限如下:
[root@localhost opt]# ll -d /var/lib/mysql/
drwxr-xr-x 4 mysql mysql 4096 Oct 16 22:31 /var/lib/mysql/
好了。[root@localhost lib]# rpm -ivh /opt/MySQL-server-5.5.28-1.rhel5.i386.rpm
Preparing...
########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
原因是之前安装过mysql,有的项目没有彻底清理掉,我的是删除了所有相关数据文件,但没有删除数据目录,所有导致错误。
结论: 在装过mysql的linux系统上再装mysql时,要把与之相关的痕迹都清理掉。