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 DOM style setting in four react components

1. Inline styles To add inline styles to the virt...

RGBA alpha transparency conversion calculation table

Conversion between rgba and filter values ​​under...

Web page production TD can also overflow hidden display

Perhaps when I name this article like this, someon...

MySQL string splitting operation (string interception containing separators)

String extraction without delimiters Question Req...

Implement a simple data response system

Table of contents 1. Dep 2. Understand obverser 3...

Solution to MySQL error code 1862 your password has expired

The blogger hasn't used MySQL for a month or ...

Express implements login verification

This article example shares the specific code for...

React mouse multi-selection function configuration method

Generally, lists have selection functions, and si...

Use overflow: hidden to disable page scrollbars

Copy code The code is as follows: html { overflow...

Linux uses shell scripts to regularly delete historical log files

1. Tools directory file structure [root@www tools...

Specific implementation methods of MySQL table sharding and partitioning

Vertical table Vertical table splitting means spl...

Essential conditional query statements for MySQL database

Table of contents 1. Basic grammar 2. Filter by c...

Detailed explanation of Linux system directories sys, tmp, usr, var!

The growth path from a Linux novice to a Linux ma...

display:grid in CSS3, an introduction to grid layout

1. Grid layout (grid): It divides the web page in...