当前位置: 移动技术网 > IT编程>数据库>Mysql > 【MySQL】MySQL数据库再安装

【MySQL】MySQL数据库再安装

2019年01月12日  | 移动技术网IT编程  | 我要评论

解决问题

  1. 安装时提示此产品配置信息损坏,怎么办?
  2. 环境检测时未响应,怎么办?
  3. 服务不能启动,怎么办?
  4. 输入密码不能登陆,不使用密码却能登录,是什么原因?

涉及到的错误代码:windows启动mysql服务1067、mysql error 1045

解决方法

电脑安装过mysql,想再次安装的时候总会出些问题。一般我们会想到的就是删除安装目录中的数据、删除c盘application data等目录下的数据,以及删除注册表中关于mysql的数据。一番删除之后,你会发现再次安装的时候,会提示你:

所以说删注册表还是要慎重呀。

解决步骤:

  1. 找到【控制面板】 -> 【管理工具】-> 【事件查看器】->【windows日志】

  2. 再次点击安装程序,等弹出配置信息损坏时,刷新【windows日志】中的应用程序,找到错误信息,在【常规】选项中会提示错误的原因:注册表中缺少值。
  3. 打开注册表:【win】+【r】打开运行窗口,输入:regedit ,打开注册表。
  4. 按照之前提示的路径,删除对应的注册表。一定要选择准确。
  5. 现在就可以继续安装了。

如果这个时候,你能一步一步安装成功,那当然最好。但是现实可能并没有那么好。下面看一下我们接着会遇见的问题。

每当安装快成功的时候,检测环境时:到启动服务,就一直出现未响应...

我们手动去启动,也会提示:无法启动 错误1067。

 

解决步骤:

  1. 修改安装目录下的my.ini文件,将default-storage-engine=innodb改为:
    default-storage-engine=myisam

  2. 启动mysql服务。当服务启动成功后,发现安装程序,第三步检测通过,当然这并不重要,等安装完了直接【skip】就可以了。也许它未响应的时候,直接关掉也不影响。

    也许这个时候,你的mysql就可以使用了。但是更可能报:error 1045.

  3. 在cmd窗口中输入mysql -uroot -p ,不能进入数据库。但是使用mysql、mysql -uroot却可以进入。
    这里也可以在my.ini文件中[mysqld]后面增加:
    #登录时跳过权限检查
    skip_grant_tables

      使用:mysql -uroot -p 命令进行登录,使用任意密码都可以登录。
      更改完root用户的密码后,应注释掉增加的内容。
      当改完密码后使用:mysql -uroot 进行登录时,同样会提示:
    c:\users\administrator>mysql -uroot
    error 1045 (28000): access denied for user 'root'@'localhost' (using password: no)
     这个时候就用密码登陆就好了。说明我们的更改生效了。
  4. 使用mysql -uroot进入数据库(注意:不要加“-p”),不要使用mysql命令直接进入。 因为他们所能看到的表不同。
    c:\users\administrator>mysql
    welcome to the mysql monitor.  commands end with ; or \g.
    your mysql connection id is 30
    server version: 5.5.62 mysql community server (gpl)
    
    copyright (c) 2000, 2018, 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)
    
    c:\users\administrator>mysql -uroot
    welcome to the mysql monitor.  commands end with ; or \g.
    your mysql connection id is 31
    server version: 5.5.62 mysql community server (gpl)
    
    copyright (c) 2000, 2018, 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 |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    4 rows in set (0.00 sec)
    只有mysql -uroot才能看到user表
  5. 修改root用户的密码:
    mysql> use mysql
    database changed
    mysql> update user set password=password('mysqladmin') where user='root';
    query ok, 3 rows affected (0.00 sec)
    rows matched: 3  changed: 3  warnings: 0
    # 刷新mysql权限相关的表(应该可以省略)
    mysql> flush privileges;
    query ok, 0 rows affected (0.03 sec)
    
    mysql> select user,password from user;
    +------+-------------------------------------------+
    | user | password                                  |
    +------+-------------------------------------------+
    | root | *a5c34f28328751b780896836c8a565c5c130175e |
    | root | *a5c34f28328751b780896836c8a565c5c130175e |
    | root | *a5c34f28328751b780896836c8a565c5c130175e |
    |      |                                           |
    +------+-------------------------------------------+
    4 rows in set (0.00 sec)
    mysql> exit
    bye
  6. 重启服务:重启服务,使用新密码登录。

终于安装成功!!!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网