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
Here are 10 tips on how to design better-usable w...
background Search the keyword .htaccess cache in ...
Table of contents JSX environment construction Se...
Set vim's working mode (temporary) :set (mode...
The "nofollow" tag was proposed by Goog...
1. Setting case sensitivity of fields in the tabl...
Common utf8mb4 sorting rules in MySQL are: utf8mb...
Possible solutions 1. Math.random generates rando...
If a website is widescreen, you drag the browser ...
Today I will introduce a small Javascript animati...
Use regular expressions to determine the IE browse...
Based on theories such as Saussure's philosop...
Preface To delete a table, the command that comes...
First, let me show you the finished effect Main i...
Find the problem I have been learning Django rece...