快捷搜索:   nginx

Centos5下构建 MySQL服务器和常见问题解决办法(2)

mysql> select user,host from mysql.user;
+------+-----------+
| user | host      |
+------+-----------+
| root | localhost |
+------+-----------+
1 row in set (0.00 sec)
mysql> exit
Bye

重新启动一次HTTP服务,让php-mysql反映到HTTP服务中
[root@centos5 /]# /etc/rc.d/init.d/httpd restart  
Stopping httpd:                                            [ OK ]
Starting httpd:                                            [ OK ]

本实验以此网页为指导!mysql其他的基本操作可参考这个网页

5月2日,出现的错误及解决办法!

今天拿台新的VMware,使用yum安装完了mysql服务,启动的时候却出现 了如下错误
[root@centos5 ~]# service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]

于是查看了下日志信息,似乎是因为mysql.host文件不存在引起的
[root@centos5 ~]# tail -f /var/log/mysqld.log
090502 20:05:26 mysqld started
090502 20:05:26 InnoDB: Started; log sequence number 0 43655
090502 20:05:26 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
090502 20:05:26 mysqld ended

在网上找到了解决的办法,具体如下:
[root@centos5 ~]# /usr/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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 centos5 password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

Support MySQL by buying support/licenses at

启动下mysql服务,这次可以正常启动了!
[root@centos5 ~]# service mysqld start
Starting MySQL:                                            [ OK ]

再次查看下日志
[root@centos5 /]# tail -f /var/log/mysqld.log
090502 20:05:26 mysqld started
090502 20:05:26 InnoDB: Started; log sequence number 0 43655
090502 20:05:26 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
090502 20:05:26 mysqld ended

090502 20:10:16 mysqld started
090502 20:10:16 InnoDB: Started; log sequence number 0 43655
090502 20:10:17 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
A mysqld process already exists at Sat May 2 20:10:39 CST 2009

查看3306端口是否开启
[root@centos5 /]# netstat -ntpl |grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3473/mysqld

重启下mysql服务,看是否能正常运行
[root@centos5 /]# service mysqld restart
Stopping MySQL:                                            [ OK ]
Starting MySQL:
                                            [ OK ]
最后,登陆试下!
[root@centos5 /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论