Linux system user account management

2023-01-25   ES  

Question description

Install it on the MAC today

AfterMySQL, mysql assigned a default password by default, but when you log in with the default password on the terminal, it will always indicate a mistake that authorized failure: Access Denied for User ‘Root’@’LocalHost’ (USING Passwork) As shown in the figure:

Since I can’t log in nowdatabase

In, it is impossible to talk about changing passwords and adding users. Fortunately, mysql also provides a method of exempting a password check to enter the database. We first use this method to log in to the database. Then replace the default password, the above problem can be solved ~ The specific operation is as follows

This operation, the corresponding different operating files under different platforms
MAC system The configuration file is the MySQL installation directory support_file my-default file
这里写图片描述

Need to note: The default configuration file does not have the writing permissions. You need to use the chmod command to add the writing permissions to the file to change

ps: The configuration file of the Windows system is mysql installation of the My.ini file to install the root directory

Open the configuration file we just found, and then find it in it[mysqld]This item, and then add it under this configuration itemskip-grant-tablesThis configuration, and then save the file.
这里写图片描述

In order to take effect on the previous configuration item, we need to restart mysql service
MAC system can restart in the system preference:
这里写图片描述 
Windows system can pass: right -click on my computer-> Service-> Find the MySQL service to restart
Linuxsystem can be used: service mysqld restart to restart

and then enter the terminal again, knock in

Themysql -u root -pcommand and then return to the car. When you need to enter the password, press the ENTER button directly, and you can log in to the database without the password

Useset password for 'username'@'host' = password('newpassword')command modify the new password.

After we changed the default password, we entered the previous configuration file again, deleted the configuration row of the password to the password, and turned into the original configuration of the system. Restart the MySQL service, and you can solve this problem next time you log in.

If you think the above operation is too troublesome, you can use the shortcuts below to achieve the above effect. For the MAC system as an example:
First enter/usr/local/mysql/support-fileIn this directory, then follow the steps on the picture to operate

这里写图片描述 
After entering the security mode of MySQL, type the four -line configuration circled in the figure (must be entered one by one), and after the input is completedcontrl+zkey end input
and then use mysql -u root -p in the terminal.pass, you can use the new password of PASS next time. The effect is the same as the above operation.

Reprinted: https://www.cnblogs.com/writelessDomore/p/682287.html

source

Related Posts

# 05-4 Class and 5 Class 5 LSA

POJ 3630 Phone list/poj 1056 [Dictionary Tree]

2021-08-18 Mechanism (handler) 01chen

Various games puppet

Linux system user account management

Random Posts

Experiment 7-2-2 matrix operation (20 points)

X86 architecture Data structure definition of linux interrupt processing IRQDESC, etc.

.bat file (%~ dp0) and call, echo batch environment variables

OPENCV mouse control window size (1.0VISON)

.bat file (%~ dp0) and call, echo batch environment variables