解决方案:如下所示
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir=C:\Professional development tools\MySQL5.7\mysql-5.7.26-winx64
datadir=C:\Professional development tools\MySQL5.7\mysql-5.7.26-winx64\data
port=3307
max_connections=200
character_set_server=utf8
# 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
default-storage-engine=INNODB
explicit_defaults_for_timestamp=true
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
default-character-set=utf8
mysqld install mysql2 --default-file="C:\Professional development tools\MySQL5.7\mysql-5.7.26-winx64\my.ini"
在bin目录下执行命令mysqld --initialize
初始化成功后,命令行没有任何提示。但在mysql5.7文件夹中已自动生成了data目录
在bin目录下执行命令net start mysql2
或者直接在系统中启动
mysql2服务启动后,去data/xxx.err文件中找到临时密码,进行登录
如我这次的临时登录密码为uyCBtUkL*4bQ
在bin目录下执行命令mysql -P3307 -uroot -p
修改密码set password for root@localhost=password('44720843');
退出exit;
重新登录并输入刚设置的新密码mysql -P3307 -uroot -p
设置本地连接ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '44720843';
5/14/2019 5:48:44 PM 已解决!