Сброс пароля на MySQL 5, Centos 5.3

Останавливаем демон MySQL и запускаем его без чтения таблицы юзеров (This option causes the server not to use the privilege system at all, which gives anyone with access to the server unrestricted access to all databases):

/etc/init.d/mysqld stop
/usr/libexec/mysqld --skip-grant-tables --user=root &

Для Дебиана команда примет следующий вид:

/usr/sbin/mysqld --skip-grant-tables --user=root

Теперь, как нам стал доступен MySQL с полным доступом, сбрасываем пароль на единицу:


mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('1') WHERE User='root'; FLUSH PRIVILEGES;"

После этого останавливаем пущенный нами инстанс MySQL и запускаем обычный сервер:

killall -9 -r mysqld
/etc/init.d/mysqld start

Ну вот и всё:

mysql -uroot -p1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>



Просмотров: 1344
17.02.2015, 19:00 -

Категория: Статьи » Администрирование