install mysql

download mysql

download mysql from ```http://dev.mysql.com/downloads/mysql/```

configure environment

add ```D:mysqlin``` to path

download the Microsoft Visual C++ 2013 Redistributable Package

```https://www.microsoft.com/en-gb/download/details.aspx?id=40784```
select vcredist_x64.exe

register mysql service

cd D:mysqlin
mysqld -install

configure mysql configuration file

edit my.ini in D:mysql

[mysqld]

basedir=D:mysql
datadir=D:mysqldata
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

initialize mysql

cd D:mysqlin
mysqld --initialize

start mysql server to check mysql service

net start mysql

configure mysql root account

start no password mode of mysql server

net stop mysql
mysqld --skip-grant-tables

start another cmd

mysql -u root
flush privileges;
grant all privileges on *.* to 'root'@'localhost' identified by 'mypassword' with grant option;
flush privileges;
exit;

kill mysqld.exe

taskkill /f /im mysqld.exe

start mysql again

net start mysql

use mysql

mysql -P 3306 -h localhost -u root -p
原文地址:https://www.cnblogs.com/otfsenter/p/7825596.html