Detailed steps to change the default password when installing MySQL in Ubuntu

Detailed steps to change the default password when installing MySQL in Ubuntu

Step 1: Enter the directory: cd /etc/mysql, view the debian.cnf file

Step 2: Log in to MySQL using the account and password in the figure above.

Step 3: View the libraries in the database.

Step 4: Use the mysql library.

Step 5: Use the following statement update user set authentication_string=PASSWORD("自定義新密碼") where user='root';

I personally keep it simple. The account is: root. Password: 123456.

Step 6: Execute the following statement: update user set plugin="mysql_native_password";

Step 7: Refresh: flush privileges;

Step 8: Exit: quit;

Step 9: Password change is complete. In the command box, enter :/etc/init.d/mysql restart; restart MySQL

Last step: log in again. Congratulations, you have successfully changed the default password.

Summarize

The above are the steps for changing the default password of MySQL installed in Ubuntu. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Ubuntu 18.04 does not prompt for password when installing MySQL and how to solve it
  • Solution to forgetting MySQL root password in Ubuntu
  • How to reset mysql server root password in ubuntu

<<:  How to use JS code compiler Monaco

>>:  How to insert a value containing single quotes or backslashes in MySQL statements

Recommend

How to install MySQL 5.7.29 with one click using shell script

This article refers to the work of 51CTO blog aut...

How to obtain and use time in Linux system

There are two types of Linux system time. (1) Cal...

Apache Log4j2 reports a nuclear-level vulnerability and a quick fix

Apache Log4j2 reported a nuclear-level vulnerabil...

How to install PHP7 Redis extension on CentOS7

Introduction In the previous article, we installe...

MySQL 8.0.17 installation and simple configuration tutorial under macOS

If you don’t understand what I wrote, there may b...

Detailed explanation of HTML style tags and related CSS references

HTML style tag style tag - Use this tag when decl...

vue-cli introduction and installation

Table of contents 1. Introduction 2. Introduction...

How to use Dockerfile to build images in Docker

Build the image Earlier we used various images fo...

How to use CSS3 to implement a queue animation similar to online live broadcast

A friend in the group asked a question before, th...

Manually install mysql5.7.10 on Ubuntu

This tutorial shares the process of manually inst...

MySQL Database Basics SQL Window Function Example Analysis Tutorial

Table of contents Introduction Introduction Aggre...

HTML Nine-grid Layout Implementation Method

Diversifying website layouts is our front-end spe...