How to set password for mysql version 5.6 on mac

How to set password for mysql version 5.6 on mac

MySQL can be set when it is installed, but it seems that lower versions cannot be set and need to be set after installation.

Under mac, mysql5.7.18 connection error, error message: Access denied for user 'root'@'localhost' (using password: YES)

The commands in () are entered in the shell. You must enter them in full, including symbols such as ; &

Step 1: Apple->System Preferences->Click MySQL at the bottom to turn off the MySQL service

Step 2: Enter the terminal and type (cd /usr/local/mysql/bin/) and press Enter

Type (sudo su) and press Enter to obtain administrator privileges.

Enter (./mysqld_safe --skip-grant-tables &) and press Enter to disable the mysql authentication function. MySQL will automatically restart and the mysql status in the preferences will become running.

Step 3: Enter the command (./mysql) and press Enter

Enter the command (flush privileges;) Don’t forget to enter the semicolon

Enter the command (set password for 'root'@'localhost' = password('root');) The root in password('root') is the new password. You can set it at will. Don't forget to enter the semicolon.

At this point, the password has been changed successfully and you can log in normally.

Summarize

The above is the simple method I introduced to you for setting the password for MySQL version 5.6 on Mac. 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!

You may also be interested in:
  • The problem of not being able to remember the SVN password of idea under mac and the solution
  • Example code for resetting PostgreSQL password on Mac
  • Solution to the problem that IntelliJ IDEA's SVN cannot save passwords on MAC
  • How to reset mysl8.0.11 password on mac
  • Tutorial on resetting the root password of Mac MySQL
  • Solution to forgetting the MYSQL database password under MAC
  • Solution to forget password when installing MySQL on Linux/Mac
  • What to do if you forget the initial password when installing MySQL on Mac
  • Common methods for retrieving system account and password on MAC

<<:  Summary of Docker configuration container location and tips

>>:  Detailed explanation of using Nodejs built-in encryption module to achieve peer-to-peer encryption and decryption

Recommend

Put frameset in body through iframe

Because frameset and body are on the same level, y...

How to use Vue3 asynchronous data loading component suspense

Table of contents Preface Creating Components Sum...

Native javascript+CSS to achieve the effect of carousel

This article uses javascript+CSS to implement the...

TypeScript namespace merging explained

Table of contents Merge namespaces with the same ...

Mysql table creation foreign key error solution

Database Table A: CREATE TABLE task_desc_tab ( id...

In-depth understanding of MySQL long transactions

Preface: This article mainly introduces the conte...

Example of how to embed H5 in WeChat applet webView

Preface WeChat Mini Programs provide new open cap...

Web page custom selection box Select

Everyone may be familiar with the select drop-dow...

Several navigation directions that will be popular in the future

<br />This is not only an era of information...

How to quickly install RabbitMQ in Docker

1. Get the image #Specify the version that includ...

How to solve the problem that Docker container has no vim command

Find the problem Today, when I tried to modify th...

jQuery combined with CSS to achieve the return to top function

CSS Operations CSS $("").css(name|pro|[...

Rules for registration form design

I finished reading "Patterns for Sign Up &...