The initial password find and reset after installation of MYSQL database

Reproduced in: https://blog.csdn.net/weixin_42129248/article/details/102911944

1.mysql Community Edition download link: https: //dev.mysql.com/downloads/file/ id = 480557?

Open the link, find the red box is connected, you can start downloading Mysql installation package of 190 megabytes look.

 

2. mounting the package to extract an arbitrary position, it is recommended to extract the C: \ Program Files

3. Under the [important] file into the folder decompression, see the directory structure should be as follows:


Delete the data folder (which may affect mysql start in the back steps we will use the command to initialize, rebuild the data folder)

4.windows + r (with windows while holding ctrl key icon next key + R key), the input cmd, enter into the command-line tool


Input the following few commands second command needs a few seconds to be to be:

mysqld install

mysqld --initialize

net start mysql

If you start mysql, you can see the following prompt:


5. If the thought you're done, you're wrong, crying, there is a pit waiting for us. Perhaps the reason version (the landlord did not study) when we enter the mysql -uroot -p hit Enter displays the following information, if the normal login skip.
Note: MySQL database prior to 5.6 (not including) the default password is empty, users do not have to enter a password, just press Enter landing


This is because the initialization time, a randomly generated password for the root account. The password can be in the / data folder suffix of .err file to view, find the file to open the Notepad, copy the code out below, my random password! & 0acBbB & qR)


6. Modify login password

a. If you have already entered mysql, mysql to enter exit to exit

b. Enter mysqladmin -u root -p password 123qwe, 123qwe for the new password, press Enter, then will enter the root password, the initial password before finding paste, the paste can be,

c. to verify that the new password mysql modified successfully


At this point the installation is complete, enjoyable to use it!

Posted some commonly used commands

exit; // exit mysql

net stop mysql // stop mysql service

sc delete mysql // delete mysql service.

doskey / history // view the command history

I find it useful, point a praise it. Endured the hungry finished

Forced landing under linux modify the mysql password
List item
set no password mysql

/etc/my.cnf Vim
. 1
found [mysqld] section, so that the cursor anywhere in the paragraph

Use the keyboard to enter and exit the save

`skip-grant-tables`

restart the restart mysqld-Service mysql
mysql mysql -u -root enter
setup password, enter the following command sequence
use mysql
Update the mysql.user SET authentication_string = password ( 'own settings') where user = 'root' ;`
privileges flush;
Exit;

will resume beginning modify the my.cnf file, then you can restart mysql

Guess you like

Origin www.cnblogs.com/xiaochendefendoushi/p/12587081.html