Problem description: I bought a Mac and installed MySQL for the first time. I don’t know the initial password. Please record how to modify the initial password. Solution: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html I have tried method 3 and successfully reset my password. (Thanks @非常, who told me that there is a reset method on the official website. I searched a lot on the Internet... In addition, step 1 and 2 are from https://www.jb51.net/article/87585.htm My English is not good, so I don’t quite understand the official one##) step1: Apple->System Preferences->Click MySQL at the bottom. In the pop-up page, turn off the MySQL service (click Stop MySQL Server). step2: Enter the terminal and enter: cd /usr/local/mysql/bin/ After pressing Enter, log in with administrator privileges sudo su After pressing Enter, enter the following command to disable the mysql authentication function./mysqld_safe --skip-grant-tables & After pressing Enter, MySQL will automatically restart (the status of MySQL in the preferences will become running) step3. Enter the command ./mysql After pressing Enter, enter the command FLUSH PRIVILEGES; After pressing Enter, enter the command SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your new password'); At this point, the password change is complete and you can log in successfully. 2. Others: Basic operations of mysql on mac terminal First, start the MySQL application manually Open the terminal and enter the following command: /usr/local/MySQL/bin/mysql -u root -p ( Note: Under Windows, it is: mysql -u root -p) Here, root is the user name. The following command will appear: Enter password: 123456 This will allow you to access your database server. Database Operations Here are some simple methods from database creation to use; Create a database named mydatabase: create database mydatabase ; You can use the following command to check whether the database was created successfully: show databases ; Change the database name: alter databases Hdatabase; Change the character set of the database mydatabase: alter database mydatabase charset GBK ; Enter the database: use mydatabase ; Use the following command to view the tables in the database: show tables; Table Operations Use the following command to create the table: create table student ( name varchar(10) , gender varchar(10) , sno int primary key(id) )charset utf8; Use the following command to check whether the table is created successfully: show tables; The above is the method I introduced to you to change the initial password of MySQL on the MAC version. 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! You may also be interested in:
|
<<: Vue form post request combined with Servlet to realize file upload function
>>: Detailed explanation of docker's high availability configuration
The paging effect is implemented in the vue proje...
Today, due to project requirements, js is needed t...
This case is based on CentOS 7 system Suitable fo...
Without further ado, I will post the code for you...
Preface Recently our server was attacked by hacke...
1.MySQL multiple instances MySQL multi-instance m...
mysql 5.7.21 winx64 installation and configuratio...
Table of contents 1. Event Processing Model 1. Ev...
Table of contents Basic application of javascript...
Table of contents 1. Modify the app.vue page 2. C...
Although head and DTD will not be displayed on th...
Environment: CentOS 7 Official documentation: htt...
The legend component is a commonly used component...
1. Page requirements 1) Use standard headers and ...