The MySQL server saves its root password in a file “.my.cnf” under the root directory. You can find out its from the file as I mentioned.
[email protected] [~]# cat /root/.my.cnf [client] password=")%:pV(Yo" user=root
If you were loged in to the server as root user, then you do not need the password to access the MySQL. You can simply access the Database by executing the command “mysql”.
[email protected] [~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 275 Server version: 5.5.35-33.0 Percona Server (GPL), Release rel33.0, Revision 611 Copyright (c) 2009-2013 Percona LLC and/or its affiliates 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> mysql>
That’s it!! 🙂
Reset mysql root password from command line
How to allow mysql client to access remote mysql databases
How to create/restore MySQL dump/backup of all the databases.
How to create a database and database user from command line
create a New Database-user and Grand Permissions