installation
-
installation
-
Configuration
- Configure Mysql Server password policy
- use strong password encryption, use strong password encryption. mysql8 supports a stronger authentication method based on SHA256, which is recommended for all newly installed mysql server. Clients or connectors cannot connect to this mysql server if they do not support this method. ☑️
- use legacy password encryption, use old password encryption.
- Configure root password: a reasonable password rule is: at least 8 characters, including numbers, letters, and other characters
- Configure Mysql Server password policy
-
Check
Open "System Preferences" and find that mysql server has been installed: it is
already running.
-
Connect the terminal to the mysql server to
open the terminal, and append the MySQL bin directory to the Path:
PATH="$PATH":/usr/local/mysql/bin
Then log in to MySQL through the following command
mysql -u root -p
If you like to change the password:
set PASSWORD =PASSWORD('123456');
- Experience mysql in the terminal to
view the database, the default is as follows:
use the database, such as mysql:
view the table under the database:
print the table structure:
desc default_roles;
- It is recommended to install mysql GUI (visual tool)
DBeaver for free.
Forgot root password
- Enter the configuration page, close the service "stop mysql server"
- Enter the terminal
cd /usr/local/mysql/bin/
Login as administrator
sudo su
Enter the following command to disable mysql authentication function
./mysqld_safe --skip-grant-tables &
After pressing Enter, mysql will automatically restart and become running
- Set password
Enter the command:
./mysql
Enter the command again
FLUSH PRIVILEGES
Then enter the command:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('你的新密码');
The new password is set successfully!