MySQL 5.6 root password modification tutorial

MySQL 5.6 root password modification tutorial

1. After installing MySQL 5.6, it cannot be enabled normally

Compressed version of MySQL, after decompression, go to: My Computer -> Properties -> Advanced -> Environment Variables

Select PATH and add the path of the mysql bin folder after it (e.g. C:\Program Files\MySQL\MySQL Server 5.6\bin )

Modify or add configuration in my-default.ini:

[mysqld] 
basedir=C:\Program Files\MySQL\MySQL Server 5.6 (the directory where mysql is located) 
datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql directory\data) 
port = 3306

Run cmd as an administrator and enter mysqld -install

After the installation is successful, you need to start the service. Continue to enter in cmd: net start mysql , and the service will be started successfully!

After the service is started successfully, you can log in. As shown in the figure, enter mysql -u root -p (there is no password for the first login, just press Enter), and the login is successful!

2. Forgot the root password of MySQL 5.6

First, net stop mysql service and switch to the task manager. If there are any processes related to mysql, it is best to close them.

Run the CMD command to switch to the MySQL installation bin directory and execute mysqld –skip-grant-tables (note that there is no semicolon at the end)

Do not close this command line window, and open a new one. Note that sometimes a warning will appear at this time, just ignore it.

Open a new cmd window again. Run the command in the bin directory as described above: mysql -u root -p , and when prompted to enter the password, just press Enter.

Execute the command:

update mysql.user set password=PASSWORD('root') where User='root';

Refresh execution: mysql> flush privileges;

Close the window and log in

3. Create a user and grant certain permissions (select, delete, update, create, drop permissions)

Log in as a user with all permissions

Create a user:

mysql> insert into mysql.user(Host,User,Password) values("localhost","test",password("1234"));

Authorize the user: grant permission on database.* to username@login host identified by "password";

Refresh the system privilege table: mysql>flush privileges;

Example 1:

mysql>grant select,update on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to modify the root user password in mysql 8.0.16 winx64 and Linux
  • How to correctly modify the ROOT password in MySql8.0 and above versions
  • Tutorial on how to modify the root password in MySQL 5.7
  • Summary of how to modify the root password in MySQL 5.7 and MySQL 8.0
  • Detailed explanation of the idea of ​​installing mysql8.0.11 and changing the root password and connecting navicat for mysql
  • Multiple methods to modify MySQL root password (recommended)
  • How to change the root password in MySQL 5.7
  • Mysql forget the root password and change the root password solution (summary)
  • How to change the root user's password in MySQL

<<:  Springboot uses vue+echarts front-end and back-end interaction to realize dynamic donut chart

>>:  Detailed description of the use of advanced configuration of Firewalld in Linux

Recommend

How to use module fs file system in Nodejs

Table of contents Overview File Descriptors Synch...

Sample code for using CSS to write a textured gradient background image

The page length in the project is about 2000px or...

N ways to center elements with CSS

Table of contents Preface Centering inline elemen...

Some slightly more complex usage example codes in mysql

Preface I believe that the syntax of MySQL is not...

How to limit the number of records in a table in MySQL

Table of contents 1. Trigger Solution 2. Partitio...

In-depth understanding of MySQL various locks

Table of contents Lock Overview Lock classificati...

Teach you to connect to MySQL database using eclipse

Preface Since errors always occur, record the pro...

MySQL DATE_ADD and ADDDATE functions add a specified time interval to a date

MySQL DATE_ADD(date,INTERVAL expr type) and ADDDA...

SQL implementation LeetCode (185. Top three highest salaries in the department)

[LeetCode] 185. Department Top Three Salaries The...

How to make a website look taller and more designed

“How to make a website look high-end? Or more des...

js uses cookies to remember user page operations

Preface During the development process, we someti...

Mysql join query syntax and examples

Connection query: It is the result of connecting ...

HTML form and the use of form internal tags

Copy code The code is as follows: <html> &l...