How to retrieve the root password in the mysql tutorial
In the php tutorial myadmin, you can enter mysql. Use the username and password used to access phpmyadmin,
If phpmyadmin can be accessed, check it in config. php or config. default. php.
Remember the mysql root Password. You can reset it using the following methods:
1. kill the mysql process in the system;
2. At the command prompt (cmd), go to the mysql bin directory and run the following command to start mysql without checking the permissions;
Mysqld-nt -- skip-grant-tables
3. Open a command prompt window again (cmd) and use the empty password to log on to mysql as the root user;
Mysql-u root
4. Modify the password of the root user;
Mysql> update mysql. user set password = password ('new password') where user = 'root ';
Mysql> flush privileges;
Mysql> quit
5. restart the computer to log on with the new password.
Solution 2: Forget the mysql root Password
Mysql root Password forgot solution:
In windows:
Open the command line window and stop mysql service: net stop mysql
Start mysql, usually to the installation path of mysql, find the mysqld-nt.exe
To this directory:
C: program filesmysqlmysql server 5.0bin>
Run: mysqld-nt -- skip-grant-tables
Open a command line window and execute mysql
> Use mysql # select a database tutorial
> Update user set passwordpassword = password ("new_pass") where user = "root";> flush privileges;> exit with ctrl + alt + del, find the mysqld-nt process and kill it. Restart the mysql-nt Service to log on with the new password.
Solution for mysql to forget the root password: in linux:
If mysql is running, killall-term mysqld is first killed.
Start mysql: bin/safe_mysqld -- skip-grant-tables &
You can access mysql without a password.
Then
> Use mysql> update user set passwordpassword = password ("new_pass") where user = "root";> flush privileges; kill mysql again and start mysql in a normal way.
If mysql is running, killall-term mysqld is first killed.
Start mysql: bin/safe_mysqld -- skip-grant-tables & (sometimes mysqld_safe)
You can access mysql without a password.
Then/usr/local/mysql/bin/mysql
> Use mysql> update user set passwordpassword = password ("new_pass") where user = "root";> flush privileges;
Solution 3: Forget the mysql root Password
Windows:
1. log on to the system as a system administrator.
2. Stop mysql services.
3. Go to the Command window and enter the mysql installation directory. For example, if my installation directory is c: mysql, go to c: mysqlbin.
4. Skip the permission check and start mysql,
C: mysqlbin> mysqld-nt -- skip-grant-tables
5. open a new window, enter the c: mysqlbin directory, and set the new root password.
C: mysqlbin> mysqladmin-u root flush-privileges password "newpassword"
C: mysqlbin> mysqladmin-u root-p shutdown
Replace newpassword with the root password you want to use. The second command will prompt you to enter a new password and repeat the password entered by the first command.
6. Stop mysql server and start mysql in Normal Mode
7. You can use a new password to link to mysql.
Unix & linux:
1. log on to the system using root or a user running mysqld;
2. Use the kill command to end the mysqld process;
3. Use the -- skip-grant-tables parameter to start mysql server
# Mysqld_safe -- skip-grant-tables &
4. Set a new password for root @ localhost
# Mysqladmin-u root flush-privileges password "newpassword"
5. Restart mysql server