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

How to use MySQL group by and order by together

Suppose there is a table: reward (reward table), ...

MySQL stored procedure in, out and inout parameter examples and summary

Stored Procedures 1. Create a stored procedure an...

Steps to install MySQL using Docker under Linux

As a tester, you may often need to install some s...

CentOS7 64-bit installation mysql graphic tutorial

Prerequisites for installing MySQL: Install CentO...

Implementation of form submission in html

Form submission code 1. Source code analysis <...

Mysql join table and id auto-increment example analysis

How to write join If you use left join, is the ta...

Use Grafana+Prometheus to monitor MySQL service performance

Prometheus (also called Prometheus) official webs...

Implementation of docker view container log command

Why should we read the log? For example, if the c...

How to run MySQL using docker-compose

Directory Structure . │ .env │ docker-compose.yml...

Web2.0: Causes and Solutions of Information Overload

<br />Information duplication, information o...

How to install nginx in docker and configure access via https

1. Download the latest nginx docker image $ docke...

Detailed steps for installing and configuring mysql 5.6.21

1. Overview MySQL version: 5.6.21 Download addres...