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

Recommended plugins and usage examples for vue unit testing

Table of contents frame First-class error reporti...

In-depth explanation of closure in JavaScript

Introduction Closure is a very powerful feature i...

Native js implements custom scroll bar component

This article example shares the specific code of ...

js realizes horizontal and vertical sliders

Recently, when I was doing a practice project, I ...

Two ways to clear table data in MySQL and their differences

There are two ways to delete data in MySQL: Trunc...

js implements mouse in and out card switching content

This article shares the specific code of js to re...

How to use lodop print control in Vue to achieve browser compatible printing

Preface This control will have a watermark at the...

What knowledge systems do web designers need?

Product designers face complex and large manufactu...

Detailed explanation of the basic commands of Firewalld firewall in Centos7

1. Basics of Linux Firewall The Linux firewall sy...

mysql5.7.14 decompressed version installation graphic tutorial

MySQL is divided into Community Edition (Communit...

Method for realizing Internet interconnection by VMware virtual machine bridging

After installing VMware and creating a new virtua...

Some common advanced SQL statements in MySQL

MySQL Advanced SQL Statements use kgc; create tab...

An in-depth introduction to React refs

1. What is Refs is called Resilient File System (...