Как переустановить lost пароль корня MySQL

[[by]] Sukrit Dhandhania на 26-ое ноября 2008

Linux Обеспеченность Windows

Вы всегда забывали ваш пароль корня MySQL? Оно одной из тех вещей как раз случается несмотря на многочисленнAp меры предосторожности, котор одно могло принять. В результате, вы locked из вашего сервера базы данных. Вы не можете создать новые базы данных и ы данных с меньшим управлением над положением вашего сервера базы данных. В таких ситуациях умея как возвратить корень достигните к вашему серверу базы данных приходит в сподручное. Настолько здесь будет вы можете сделать для того чтобы переустановить пароль для потребителя корня в MySQL как на Windows, так и на Linux.

Потребители Windows:

Logon к вашему серверу как администратор. Убейте сервера MySQL если он бежит. Для того чтобы сделать это вам нужно Менеджер обслуживаний Windows, поэтому щелкните дальше Начните меню, после этого пойдите к Пульт управления, после этого к Управленческие инструменты, и отборно Обслуживания. Здесь ищите сервер MySQL и остановите его. Если оно не перечислено там и, то MySQL до бежать оно намеревается что MySQL не бежит как обслуживание. В тот случай вам нужно нагрузить менеджера задачи вы достигли использующ ключевую комбинацию Ctrl+Alt+Del. Теперь убейте процесс MySQL.

При остановленный процесс MySQL вам нужно принудить изменение паролей на MySQL использующ комбинацию УТОЧНЕНИЕ и ПРИТОК варианты. Так запустите ваше любимейшее редактор текста и создайте новый архив. Впишите following текст в архив заменяя ть «NewMySQLPassword» с вашим новым паролем:

УТОЧНЕНИЕ mysql.user УСТАНОВЛЕННОЕ Password=PASSWORD (» NewMySQLPassword») ГДЕ User=' корень';
ПОЛНЫЕ ПРИВИЛЕГИРОВАННОСТИ;

Первая линия делает что оно уточняет значение поля «пароля» в таблице mysql.user для потребителя «корня» «NewMySQLPassword». Вторая линия топит старый комплект привилегированностей и make sure ваш новый пароль использован везде. За исключением этого текста как C:\mysql _reset.txt.

Затем, вам нужно начать вашего сервера MySQL пройти этот архив как параметр конфигурации. Запустите стержень путем идти к Начните меню, после этого к Бег, и после этого напечатайте на машинке cmd и удар входит. Теперь впишите following команду:

C:\mysql\bin\mysqld - nt --init-file= C:\mysql _reset.txt

Как только сделан сервер начиная delete архив C:\mysql _reset.txt. Ваш пароль корня MySQL должен быть переустановлен теперь. Теперь повторяйте старт вашего сервера MySQL снова. Идите back to менеджер обслуживаний Windows снова сделать то. Ваш новый пароль корня MySQL должен работать для вас теперь.

Потребители Linux:

Log on to your Linux machine as the root user. The steps involved in resetting the MySQL root password are to stop the MySQL server, restart it without the permissions active so you can log into MySQL as root without a password, set a new password, and then restart it normally. Here’s how you do it. First, stop the MySQL server:

# /etc/init.d/mysql stop

Now start the MySQL server using the --skip-grant-tables option, which will run the server without loading the permissions settings:

# mysqld_safe --skip-grant-tables &

The & option at the end makes the command you have executed run as a background process. Now log on to your MySQL server as root:

# mysql -u root

It should allow you in without prompting for a password. The following steps will set the new password:

mysql> use mysql;
mysql> update user set password=PASSWORD(”NewMySQLPassword”) where User=’root’;
mysql> flush privileges;
mysql> quit

Replace “NewMySQLPassword” with your own password. Here’s what happens here. The first line selects the MySQL configuration tables. The second line updates the value of the field “Password” for the user “root” to “NewMySQLPassword”. The third line flushes the old set of privileges and makes sure your new password is used everywhere. Now, the last step is to restart the server normally and use your new root password to log in:

# /etc/init.d/mysql stop
# /etc/init.d/mysql start
# mysql -u root -pNewMySQLPassword

Congratulations, your new MySQL root password is set and your MySQL server is ready to be used again. Remember to update all your applications to use this password if you are using it anywhere.

Related Posts:
  • How to remotely access your MySQL in a secure manner
  • How to enable the root user account in Ubuntu Linux
  • Bash one liner - how to compress, move, and extract a directory
  • How to reset the logo in Internet Explorer
  • How to install and setup Apache, MySQL and PHP in Windows
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.

    { 4 comments… read them below or add one }

    1 Marcos Santos 12.24.08 at 7:53 pm

    OI como faço para recuperar a senha do root do linux Kurumin

    2 xxxxxxx 05.20.09 at 8:13 am
    3 Manfred 06.10.09 at 2:25 am

    BTW the syntax above is missing a -
    There should be a double minus sign in front of the init. Do that and the commands work fine. Looking at it, its missing elsewhere too - so might be your blog s/w converting double en dash to em dash

    C:\mysql\bin\mysqld-nt -–init-file=C:\mysql_reset.txt

    4 Ross McKillop 06.10.09 at 6:05 am

    Thanks Manfred - you’re right, it did convert the double-dashes into a single dash. It’s all fixed now. Thanks again!

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>