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

MySQL 5.5.56 installation-free version configuration method

The configuration method of MySQL 5.5.56 free ins...

How to insert weather forecast into your website

We hope to insert the weather forecast into the w...

Docker installs mysql and solves the Chinese garbled problem

Table of contents 1. Pull the mysql image 2. Chec...

A MySQL migration plan and practical record of pitfalls

Table of contents background Solution 1: Back up ...

Introduction to Semantic XHTML Tags

The first point to make is that people can judge t...

The use and difference between JavaScript pseudo-array and array

Pseudo-arrays and arrays In JavaScript, except fo...

Detailed process of compiling and installing Storm on Kylin V10 server

1 Introduction Apache Storm is a free, open sourc...

Vue+swiper realizes timeline effect

This article shares the specific code of vue+swip...

JQuery implements hiding and displaying animation effects

This article shares the specific code of JQuery t...

How to deploy LNMP architecture in docker

Environmental requirements: IP hostname 192.168.1...

Examples of implementing progress bars and order progress bars using CSS

The preparation for the final exams in the past h...

Vue implements simple calculator function

This article example shares the specific code of ...