返回列表 发帖

[未知] 请教各位大侠几道困惑的疑问

现在有几道疑问请教:

[root@OEM share]# ps -ef| grep mysql
root      4640  3894  0 09:39 pts/3    00:00:00 grep mysql
[root@OEM share]# /etc/init.d/mysql start
Starting MySQL...                                          [  OK  ]
[root@OEM share]# ps -ef| grep mysql
root      4675     1  0 09:40 pts/3    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data/mysql --pid-file=/opt/data/mysql/OEM.pid
mysql     4914  4675  1 09:40 pts/3    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/opt/data/mysql/OEM.err --pid-file=/opt/data/mysql/OEM.pid --socket=/tmp/mysql.sock --port=3306
root      4942  3894  0 09:40 pts/3    00:00:00 grep mysql
[root@OEM share]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@OEM share]# mysqladmin status
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@OEM share]# 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.5.16-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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

mysql>

疑问1:
    为什么
[root@OEM share]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@OEM share]# mysqladmin status
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
不能登入呢?一定要这样才能登入
[root@OEM share]# mysql -u root -p
上网查了一下,说是权限、修改密码、/etc/host 文件问题等等,都没没解决。

疑问2:
  mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.00 sec)
什么没有mysql  database 呢?
难道是和/bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data/mysql --pid-file=/opt/data/mysql/OEM.pid 启动有关?

疑问3:
   为什么是/usr/local/mysql/bin/mysqld_safe启动模式呢?
   在my.cnf里没有修改什么。
   怎么修改成正常启动模式?

谢谢各位!

你为root设定登录密码了,试试[root@OEM share]# mysql -p 能不能登录

TOP

返回列表