Detailed tutorial on setting password for MySQL free installation version

Detailed tutorial on setting password for MySQL free installation version

Method 1: Use the SET PASSWORD command

 MySQL -u root
  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

Method 2: Using mysqladmin

mysqladmin -u root password "newpass"

If the root password has been set, use the following method

mysqladmin -u root password oldpass "newpass"

Method 3: Use UPDATE to edit the user table directly

mysql -u root
  mysql> use mysql;
  mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
  mysql> FLUSH PRIVILEGES;

When you lose your root password, you can

mysqld_safe --skip-grant-tables&
  mysql -u root mysql
  mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
  mysql> FLUSH PRIVILEGES;

The above is a detailed tutorial on setting passwords for the MySQL free installation version introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time!

You may also be interested in:
  • Mysql 5.7.17 winx64 free installation version, installation and configuration graphic tutorial under win10 environment
  • MySQL 5.6 free installation version environment configuration graphic tutorial
  • MYSQL ZIP installation-free version configuration steps and graphical management tool mysql-workbench
  • Detailed explanation and sharing of the configuration steps of the MySQL free installation version
  • The actual configuration method of MySQL free installation version
  • Mysql default character set setting method (free installation version)

<<:  Methods for optimizing Oracle database with large memory pages in Linux

>>:  Canvas draws scratch card effect

Recommend

Detailed explanation of this pointing problem in JavaScript

Preface Believe me, as long as you remember the 7...

How does Zabbix monitor and obtain network device data through ssh?

Scenario simulation: The operation and maintenanc...

Detailed explanation of nginx configuration file interpretation

The nginx configuration file is mainly divided in...

JS implements simple example code to control video playback speed

introduction I discovered a problem before: somet...

Detailed explanation of virtual DOM in Vue source code analysis

Why do we need virtual dom? Virtual DOM is design...

Sharing experience on MySQL slave maintenance

Preface: MySQL master-slave architecture should b...

JavaScript to implement search data display

This article shares the data display code for Jav...

MySQL 5.7.18 free installation version configuration tutorial

MySQL 5.7.18 free installation version installati...

Complete steps to use mock.js in Vue project

Using mock.js in Vue project Development tool sel...

Detailed explanation of Mysql communication protocol

1.Mysql connection method To understand the MySQL...

Detailed explanation of the workbench example in mysql

MySQL Workbench - Modeling and design tool 1. Mod...

js realizes the magnifying glass effect of shopping website products

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

js implements single click to modify the table

Pure js implements a single-click editable table ...

A complete guide to clearing floats in CSS (summary)

1. Parent div defines pseudo-classes: after and z...