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

Example code of javascript select all/unselect all operation in html

Copy code The code is as follows: <html> &l...

What does the n after int(n) in MySQL mean?

You may already know that the length 1 of int(1) ...

WeChat applet implementation anchor positioning function example

Preface In the development of small programs, we ...

Introduction to 10 online development tools for web design

1. Online Text Generator BlindTextGenerator: For ...

JavaScript+html to implement front-end page sliding verification

This article shares the specific code of JavaScri...

Detailed explanation of JavaScript prototype and examples

Table of contents The relationship between the co...

Basic security settings steps for centos7 server

Turn off ping scanning, although it doesn't h...

Summary of MySQL time statistics methods

When doing database statistics, you often need to...

How to use Nexus to add jar packages to private servers

Why do we need to build a nexus private server? T...

Count the list tags in HTML

1. <dl> defines a list, <dt> defines ...

15-minute parallel artifact GNU Parallel Getting Started Guide

GNU Parallel is a shell tool for executing comput...

Native js implementation of slider interval component

This article example shares the specific code of ...

GDB debugging MySQL actual combat source code compilation and installation

Download source code git clone https://github.com...