Under install windows install mysql

Reference document: https://www.cnblogs.com/reyinever/p/8551977.html   https://www.jb51.net/article/151213.htm

First, download the installation package mysql ( https://dev.mysql.com/downloads/mysql/ ), my version is (mysql-8.0.17-winx64) then decompress the file folder you define, configure the environment variables, variable name: MYSQL_HOME, variable value: D: \ mysql \ mysql- 8.0.17-winx64, path was added:% MYSQL_HOME% \ bin;

Run as administrator cmd, (you can right-click cmd run as administrator)

Note: no need to configure my.ini file, do not add your own data file manually, as I did not connect these services after configuration.

Into your local mysql's bin directory, my local is D: \ mysql \ mysql-8.0.17-winx64 \ bin, in D: \ mysql \ mysql-8.0.17-winx64 directory next time generating data generated directory directory .

Execute the command: mysqld --initialize-insecure --user = mysql 

 Execute the command: net start mysql start mysql service, if prompted: service name is invalid ... (see next step);

Tip: The service name is invalid

Solution: Execute the command: mysqld -install to perform again: net start mysql displays the service is started.

输入 mysql -u root -p,由于密码为空直接回车就好。下面更改密码,要先选择数据库,输入:use mysql; 这个版本的更改密码的语法跟其他版本稍有不同,我查了数据库文档才找到正确语法来更改数据库密码(https://dev.mysql.com/doc/refman/8.0/en/set-password.html),输入: SET PASSWORD FOR '用户名'@'localhost' = '密码';然后退出 exit,重新输入:mysql -u root -p,再输入新密码,数据库算是配置好了。

Guess you like

Origin www.cnblogs.com/wzjbg/p/11256655.html