I cannot figure out my MySQL root password; how can I find this out? Is there any file where this password is stored?
I am following this link but I do not have dir
MySQL 5.7 and above saves root in MySQL log file.
Please try this:
sudo grep 'temporary password' /var/log/mysqld.log
This worked for me:
On terminal type the following
$ sudo mysql -u root -p
Enter password://just press enter
mysql>
The default password which worked for me after immediate installation of mysql server is : mysql
Follow these steps to reset password in Windows system
Stop Mysql service from task manager
Create a text file and paste the below statement
MySQL 5.7.5 and earlier:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yournewpassword');
MySQL 5.7.6 and later:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yournewpassword';
Save as mysql-init.txt
and place it in 'C' drive
.
Open command prompt and paste the following
C:\> mysqld --init-file=C:\\mysql-init.txt
Unless the package manager requests you to type the root password during installation, the default root password is the empty string. To connect to freshly installed server, type:
shell> mysql -u root --password=
mysql>
To change the password, get back the unix shell and type:
shell> mysqladmin -u root --password= password root
The new password is 'root'. Now connect to the server:
shell> mysql -u root --password=
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Oops, the password has changed. Use the new one, root
:
shell> mysql -u root --password=root
...
blah, blah, blah : mysql welcome banner
...
mysql>
Bingo! New do something interesting
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
Maurycy