Home > Database > Mysql Tutorial > body text

mysql的root用户被删除, MySQL 服务无法启动 1067错误

WBOY
Release: 2016-06-07 15:46:23
Original
1321 people have browsed it

本文出现的问题有: 1, root(localhost) 用户被删除; 2, 在关闭mysql服务过后, 无法启动,出现1067错误; 我使用的mysql版本为5.6; mysql的安装路径:C:\Program Files (x86)\MySQL; mysql数据路径:C:\ProgramData\MySQL; my.ini就在数据路径当中; 无法启动mysql

本文出现的问题有:

1, root(localhost) 用户被删除; 

2, 在关闭mysql服务过后, 无法启动,出现1067错误;


我使用的mysql版本为5.6;

mysql的安装路径: C:\Program Files (x86)\MySQL;

mysql数据路径: C:\ProgramData\MySQL;

my.ini就在数据路径当中;


无法启动mysql服务,出现1067,的解决办法:

删除数据目录下,data目录下的ib_logfile0和ib_logfile1文件。


root用户被删除的解决办法:


1, 关闭mysql服务;

2, 开启mysql56服务;

3, 在my.ini中的[mysql]后面加入: skip-grant-tables

4, 使用命令行登陆mysql: mysql -uroot -p, 无须密码登陆成功;

5, mysql> use mysql;

Database changed

6, mysql> select * from user;

Empty set (0.00 sec) 

7, mysql> insert into user set user='root',ssl_cipher='',x509_issuer='',x509_subject='';

Query OK, 1 row affected (0.00 sec)

(这时可能会提示某字段如ssl_cipher无默认值, 只要加上,ssl_cipher=''; 其字段如有提示依次添加就OK了)


8, mysql> update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';

Query OK, 1 row affected (0.00 sec)



9, 去关闭mysql56服务; (如果没有关闭mysql56,就直接去开启mysql就会出现1067错误)

10, 开启mysql服务;

11, 删除my.ini中的之前的那句话;


正常情况下登陆mysql;

原来的数据全部回来了!!!!!

(此时尚未设置root的密码)


注:

在root没有密码的情况下 输入密码登陆就会失败;






Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template