How does one install mysql on linux/mac and forget the password?

Source: Internet
Author: User

How does one install mysql on linux/mac and forget the password?

Preface

This article describes how to install mysql on linux/mac and how to forget the password. I will share the information for your reference. I will not talk about it here. Let's take a look at the detailed introduction.

Devices Used

COMPUTER: linux or like-linux OS

Mysql version: 5.7 +

Problem description

After the installation is complete, you cannot run the commandmysql -u root Connect to the database

Solution

Generally, the mysql server installed through dmg is located/usr/local/mysql-version-name-.../

Enter this directory and then entercd ./bin

# If you are running mysql, disable mysql service $ sudo lsof-I: 3306 $ sudo kill-9 mysql-pid # enable mysql security mode $ sudo. /mysqld_safe -- skip-grant-tables # Enter mysql shell $ sudo. /mysql-u root # modify mysql. the root user password in the user table $ update mysql. user set authentication_string = PASSWORD ('You password') where User = 'root'; # The modification is complete.

Background

After the modification, if you use a navicat connection to change the database, you will be prompted to change the password and re-enter the password. Because the modified password is still marked as expired in security mode, so can be changed again.

Summary

The above is all the content of this article. There are still many shortcomings in this article. I hope this article will have some reference and learning value for everyone's learning or work. If you have any questions, please leave a message, thank you for your support.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.