您的位置:首页 > 数据库 > MySQL

关于mysql数据库不出现名为mysql数据库的解决办法

2015-11-16 13:01 513 查看

关于mysql数据库不出现名为mysql数据库的解决办法

另外该方法同样可ERROR 1045 (28000): Access denied for user ‘melina’@’localhost’ (using password: YES)类型的错误

首先用root权限执行 /etc/init.d/mysqld stop 停止mysql服务器

接着执行 # mysqld_safe –skip-grant-tables & 确定服务器已停止,出现如下信息:

[1] 16071

# 151116 12:38:56 mysqld_safe Logging to ‘/var/log/mysqld.log’.

151116 12:38:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

看到上面的结果后,输入mysql -u melina 出现下面结果:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.73 Source distributionCopyright (c) 2000, 2013, 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>

输入use mysql,切换到mysql数据库

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

5.执行更新密码

mysql>update user set password=password(“root”) where user=”root”;

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4 Changed: 4 Warnings: 0

mysql> commit;

Query OK, 0 rows affected (0.00 sec)

mysql> exit;

Bye

退出后输入如下命令启动:mysql -uroot,如下:

# mysql -u root

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.1.37-1ubuntu5.5 (Ubuntu)

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

mysql>

6.然后输入show databases;

mysql> show dataabses;

应该会出现mysql数据库
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: