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

来源:互联网 发布:网络合作学习平台 编辑:程序博客网 时间:2024/05/22 16:32

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

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

  1. 首先用root权限执行 /etc/init.d/mysqld stop 停止mysql服务器
  2. 接着执行 # 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

  3. 看到上面的结果后,输入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>

  4. 输入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数据库

0 0
原创粉丝点击