Mysql服务无法启动的解决办法 [root@localhost Server]# service mysqld restart 停止 MySQL: [失败] 初始化 MySQL 数据库: Neither host 'localhost.localdomain' nor 'localhost' could be looked up with /usr/bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option [失败] [root@localhost Server]# service mysqld restart 停止 MySQL: [失败] 初始化 MySQL 数据库: Neither host 'localhost.localdomain' nor 'localhost' could be looked up with /usr/bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option [失败] [root@localhost Server]# vim /etc/hosts (见后文) [root@localhost Server]# vim /etc/sysconfig/network (见后文) [1]+ Stopped vim /etc/sysconfig/network [root@localhost Server]# service mysqld restart 停止 MySQL: [失败] 初始化 MySQL 数据库: WARNING: The host 'localhost.localdomain' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... 110108 0:04:57 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 110108 0:04:57 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 OK Filling help tables... 110108 0:04:58 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 110108 0:04:58 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 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 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. 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 http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com [确定] 启动 MySQL: [确定] 注意前面启动失败,都是因为主机名不是localhost [root@localhost Server]#vim /etc/hosts ================================================================ # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost ::1 localhost6.localdomain6 localhost6 =============================================================== [root@localhost Server]# vim /etc/sysconfig/network ============================================================= NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=localhost.localdomain ==============================================================