English 中文(简体)
• 如何重塑被遗忘的MySQL根口?
原标题:How to reset the forgotten MySQL root password?
  • 时间:2014-06-30 12:16:51
  •  标签:
  • mysql

我一直在试图重写我的我的我的我的我的我的我的我的我的教职。

我使用了两种方法重新确定。 但我原意是这样做。

在采取措施之后, 但对我来说,这并不重要:

Method 1:

  1. 停止运营MySQL服务,并制作了一部神秘的锡尔特文件。 mysql-init.txt 包括:

     USE mysql;
     UPDATE mysql.user SET Password=PASSWORD( vikash ) WHERE User =  root ;   
    FLUSH PRIVILEGES;
    
  2. 我已迅速开始指挥,并一分为二:

    C:Program FilesMySQLMySQL Server 5.6in>mysqld.exe --defaults-file="my.ini" --init-file="C:\Users\user-name\Desktop\mysql-init.txt" --console
    

    The ERROR, I got:

    Could not open required defaults file: C:Program FilesMySQLMySQL Server 5.6inmy.ini
    Fatal error in defaults handling. Program aborted
    

Method 2:

我只是立即宣布指挥开始,其类型如下:

C:Program FilesMySQLMySQL Server 5.6in>mysqladmin -uroot -psample password
vikash

我的错误是:

Warning: Using a password on the command line interface can be insecure.
mysqladmin: connect to server at  localhost  failed
error:  Access denied for user  root @ localhost  (using password: YES) 

请帮助我重写密码。

最佳回答

停止我的服务

/etc/init.d/mysqld stop

提供可执行的安全微额贷款

mysqld_safe --skip-grant-tables &

(拖车后回到指挥线)

之后,将根基连接起来,没有密码

mysql -uroot

你们会迅速,能够更新根本的密码。

www.un.org/spanish/ga/president 我刚刚看到你再次使用窗户。 因此,你的第一种方法几乎应当奏效。 文档应改为“最终用户”。

SET PASSWORD FOR  root @ localhost  = PASSWORD( vikash );

其后

C:Program FilesMySQLMySQL Server 5.6in>mysqld.exe --init-file=C:Usersuser-nameDesktopmysql-init.txt

我很想知道,尽管......所有这些空白空间都可能混淆窗户。 也许更容易在可起诉的同一方面创建你自己的档案,这样你才不得不管理。

mysqld.exe --init-file=mysql-init.txt

那里可能有其他迫害者。 我的原机、我的手法等。 如果我方言不行,也审判他人。

问题回答

下面是重写用户密码的过程,当时我们放弃了使用者的密码,或者错失了在安装期间提供的密码。

  • OS: Ubuntu 16.04
  • MySQL: 5.7
  1. Stop Mysql Server sudo /etc/init.d/mysql stop
  2. To avoid the error, mysqld_safe Directory /var/run/mysqld for UNIX socket file don t exists , run below commands: sudo mkdir -p /var/run/mysqld sudo chown mysql:mysql /var/run/mysqld
  3. Start mysql in safe mode: sudo mysqld_safe --skip-grant-tables &
  4. Login to Mysql and change the password to say root123 : In 5.7 version the password column is renamed as authentication_string. mysql -uroot mysql>use mysql; mysql>update user set authentication_string=password( root123 ) where user= root ;
  5. If you get the error :: MySQL fails on: mysql “ERROR 1524 (HY000): Plugin auth_socket is not loaded” then run below commands and then run 4th Step. mysql>update user set plugin="mysql_native_password" where User= root ; mysql>flush privileges; quit;
  6. Stop and Start mysql server sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start
  7. Login with the new password mysql -uroot -proot123

参考。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签