您的位置:首页 > 运维架构 > Linux

Centos 5.6安装Mysql(步骤,疑问)

2014-03-25 11:29 405 查看
1.安装步骤

yum install mysql

yum install mysql-server

yum install mysql-devel

chgrp -R mysql /var/lib/mysql

chmod -R 770 /var/lib/mysql

service mysqld start

mysql -u root

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

2常见问题

(1)如果yum install 出现 Transaction Check Error:

错误可以采用以下解决办法:

Transaction Check Error:

file /usr/lib/mysql/libmysqlclient.so.15.0.0 from install of mysql-5.0.77-4.el5_5.4.i386 conflicts with file from package mysqlclient15-5.0.91-1.jason.1.i386

file /usr/lib/mysql/libmysqlclient_r.so.15.0.0 from install of mysql-5.0.77-4.el5_5.4.i386 conflicts with file from package mysqlclient15-5.0.91-1.jason.1.i386

解决办法:

#yum remove mysql mysql-devel mysql-server

如果还是不行,使用绝招:

rpm -Uvh --force mysql-5.0.77-4.el5_5.4.i386.rpm

rpm -Uvh --force mysql-server-5.0.77-4.el5_5.4.i386.rpm

rpm -Uvh --force mysql-devel-5.0.77-4.el5_5.4.i386.rpm

(2)MySQL错误Another MySQL daemon already running with the same unix socket

在国外网站发现的解决方法。

原因多个Mysql进程使用了同一个socket。

两个方法解决:

第一个是立即关机 使用命令 shutdown -h now 关机,关机后在启动,进程就停止了。

第二个直接把mysql.sock文件改名即可。也可以删除,推荐改名。

然后就可以启动mysql了。

下面是国外原文

To prevent the problem from occurring, you must perform a graceful shutdown of the server from the command line rather than powering off the server.

# shutdown -h now

This will stop the running services before powering down the machine.

Based on Centos, an additional method for getting it back up again when you run into this problem is to move mysql.sock:

# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

# service mysqld start
Restarting the service creates a new entry called mqsql.sock

(3)service myqsld start 发现还是提示"mysql deamon failed to start"错误信息.

# /etc/init.d/mysqld start
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]


先查看当前配置信息.

# getenforce
Enforcing

就表明SELinux已经启用.只需要关闭即可。

关闭方法:

#setenforce 0       (0|1  开|关)

或者

setsebool ftpd_disable_trans 1

命令也可以

(4)yum提示another app is currently holding the yum lock;waiting for it to exit

可能是系统自动升级正在运行,yum在锁定状态中。
可以通过强制关掉yum进程:
#rm -f /var/run/yum.pid
然后就可以使用yum了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: