Saturday, August 10, 2013

Reset root password for mysql

Session 1:
[mysql@rh6 mysql]$ /lab/mysql/mysql-server/mysql/bin/mysqld --no-defaults --basedir=/lab/mysql/mysql-server/mysql  --skip-grant-tables
130810  2:42:53 [Note] Plugin 'FEDERATED' is disabled.
130810  2:42:53 InnoDB: The InnoDB memory heap is disabled
130810  2:42:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130810  2:42:53 InnoDB: Compressed tables use zlib 1.2.3
130810  2:42:53 InnoDB: Using Linux native AIO
130810  2:42:53 InnoDB: Initializing buffer pool, size = 128.0M
130810  2:42:53 InnoDB: Completed initialization of buffer pool
130810  2:42:53 InnoDB: highest supported file format is Barracuda.
130810  2:42:53  InnoDB: Waiting for the background threads to start
130810  2:42:54 Percona XtraDB (http://www.percona.com) 5.5.32-rel31.0 started; log sequence number 1597945
130810  2:42:54 [Note] /lab/mysql/mysql-server/mysql/bin/mysqld: ready for connections.
Version: '5.5.32-rel31.0'  socket: '/tmp/mysql.sock'  port: 3306  Percona Server with XtraDB (GPL), Release rel31.0, Revision 549

Session 2:
[mysql@rh6 ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32-rel31.0 Percona Server with XtraDB (GPL), Release rel31.0, Revision 549

Copyright (c) 2009-2013 Percona Ireland Ltd.
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> UPDATE mysql.user SET Password=PASSWORD('masked_my_password')  WHERE User='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

No comments:

Post a Comment