Ref:
百度搜索 mysql 安装
https://www.cnblogs.com/ayyl/p/5978418.html
http://www.runoob.com/mysql/mysql-install.html
https://blog.csdn.net/qq_39539763/article/details/79515365
https://www.cnblogs.com/gumuzi/p/5711495.html
https://www.cnblogs.com/qq78292959/p/3641972.html 方法一
以管理员方式运行cmd,以下均是:
I:\javasoft\mysql-5.6.24-win32\bin>cd /d I:\javasoft\mysql-5.6.24-win32\bin
I:\javasoft\mysql-5.6.24-win32\bin>mysqld --initialize-insecure --user=mysql
I:\javasoft\mysql-5.6.24-win32\bin>mysqld install
I:\javasoft\mysql-5.6.24-win32\bin>net start mysql
-------------------------------
I:\javasoft\mysql-5.6.24-win32\bin>mysql -u root
运行该命令出现错误
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
I:\javasoft\mysql-5.6.24-win32\bin>mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y ES)
------------------------------------------
I:\javasoft\mysql-5.6.24-win32\bin>net stop mysql
my.ini 文件增加该参数 skip-grant-tables
[mysqld]
# innodb_buffer_pool_size = 128M
# log_bin
# These are commonly set, remove the # and set as required.
basedir=I:\javasoft\mysql-5.6.24-win32
datadir=I:\javasoft\mysql-5.6.24-win32\data
port=3306
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-grant-tables
重新启动mysql 服务
I:\javasoft\mysql-5.6.24-win32\bin>net start mysql
I:\javasoft\mysql-5.6.24-win32\bin>mysql
mysql> show databases;
mysql> use mysql;
发现里面多出了mysql数据库
mysql> select Password from user where user='root';
mysql> update user set password=password("123456") where user="root";
mysql> select Password from user where user='root';
mysql> flush privileges;
mysql> exit;
-----------------------------------------------------------------------
密码改好后,在my.ini 文件中,remove 参数 skip-grant-tables,
再重启mysql 服务。
-------------------------------------------------------------------------
验证测试
I:\javasoft\mysql-5.6.24-win32\bin>mysql -u root -p
Enterpassword:123456
========================================
安装过程中如果出现:msvcr120.dll 丢失问题:参考
https://blog.csdn.net/wzhedward/article/details/79069179
https://www.microsoft.com/zh-CN/download/details.aspx?id=40784
下载安装即可。