国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

如何添加誤刪除mysql數(shù)據(jù)庫root賬號

2017-09-28 22:47:04 8405

mysql數(shù)據(jù)庫的root賬號被誤刪除了如何添加

1.打開mysql.ini文件在mysqld下面添加skip-grant-tables后重啟mysql數(shù)據(jù)庫.

2. 直接執(zhí)行mysql命令進(jìn)入數(shù)據(jù)庫

MariaDB [mysql]> insert into mysql.user set user='root'; 插入一個賬號(執(zhí)行下面命令,設(shè)置root用戶的權(quán)限,所有權(quán)限為 ' y ' ,即擁有最高權(quán)限。)

MariaDB [mysql]> update user set Host='localhost',select_priv='y', insert_priv='y',

update_priv='y',Alter_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';
image.png

4.退出后重啟mysql數(shù)據(jù)庫執(zhí)行mysql –uroot –p 直接回車進(jìn)入數(shù)據(jù)庫設(shè)置root密碼
MariaDB [(none)]> update mysql.user set password=password('1234567') where user=

'root';
MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit
image.png

5.去掉my.ini中的skip-grant-tables后重啟數(shù)據(jù)庫就可以使root賬號進(jìn)入mysql數(shù)據(jù)庫了
image.png


提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: