安装mysql出错。

安装mysql出错。

[root@localhost mysql-5.1.30]# /server/mysql/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
090406 12:46:13 [ERROR] /server/mysql/libexec/mysqld: unknown option '--skip-federated'
090406 12:46:13 [ERROR] Aborting

090406 12:46:13 [Note] /server/mysql/libexec/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
/server/mysql/var for more information.

You can try to start the mysqld daemon with:

    shell> /server/mysql/libexec/mysqld --skip-grant &

and use the command line tool /server/mysql/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /server/mysql/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /server/mysql/var that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com/.  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 /server/mysql/bin/mysqlbug script!





/server/mysql/bin/mysqld_safe --user=mysql &
[1] 15050
[root@localhost mysql]# 090406 12:50:51 mysqld_safe Logging to '/server/mysql/var/localhost.localdomain.err'.
090406 12:50:53 mysqld_safe Starting mysqld daemon with databases from /server/mysql/var
090406 12:50:53 mysqld_safe mysqld from pid file /server/mysql/var/localhost.localdomain.pid ended


[root@localhost mysql]# bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
以下是我的my.cnf

重点是加如下配置。

[client]
socket=/var/lib/mysql/mysql.sock




参考一下这个my.cnf配置。改成这样的,然后重启数据库,应该就没有问题了。


[ydl-centos]#more /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
#socket=/tmp/mysql.sock
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
socket=/var/lib/mysql/mysql.sock
[mysqladmin]
socket=/var/lib/mysql/mysql.sock
[client]
socket=/var/lib/mysql/mysql.sock