Rootop 服务器运维与web架构

Neither host ‘localhost’ nor ‘localhost’ could be looked up

| 暂无评论

安装MYSQL数据库时,启动服务遇到问题,提示如下,由提示错误可以看出,是因为主机名的解析有问题

查看/etc/hosts,文件中没有任何内容,添加一行配置,内容如下:

127.0.0.1        localhost

保存退出,重启服务测试

之前的错误提示:

[root@localhost yum.repos.d]# service mysqld start
初始化 MySQL 数据库: Neither host ‘localhost’ 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 yum.repos.d]# vi /etc/hosts
[root@localhost yum.repos.d]# service mysqld start
初始化 MySQL 数据库: Installing MySQL system tables…
100329 18:18:19 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to

4294967295
100329 18:18:19 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to

4294967295
OK
Filling help tables…
100329 18:18:19 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to

4294967295
100329 18:18:19 [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 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:                                               [确定]
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

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

mysql> show databases
    -> ;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
| test               |
+——————–+
3 rows in set (0.00 sec)

mysql> exit
Bye
[root@localhost yum.repos.d]# mysqladmin -u root password root      //修改密码为root

[root@localhost yum.repos.d]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.77 Source distribution

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

mysql>

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/114.html

作者:Venus

服务器运维与性能优化

发表回复