最近安装新版本中启动mysql提醒“启动出现本地计算机上的mysql启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”
看下根目录下有没有my.ini,没有创建一个。
加入下面代码
[php]
# 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 = …..
# datadir = …..
# port = …..
# 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
port = 3306
basedir=E:\Program Files\php\mysql57
datadir=E:\Program Files\php\mysql57\data
#tmpdir=E:\Program Files\php\mysql57\data
#max_connections=200
#default-storage-engine=INNODB
#character-set-server=utf8mb4
#collation-server=utf8mb4_general_ci
[mysql]
default-character-set=utf8
[/php]
先看下根目录下有没有data文件夹,如果么有就创建一个data文件夹,有的话就清空data文件夹下的所有内容。
然后执行mysqld –initialize-insecure –user=mysql。执行后就能启动mysql了。
登陆mysql,在data下查看DESKTOP-B7N0OIP.err,是.err后缀的文件,这里面会告诉你密码是多少。
我这里查看到密码默认是空的
root@localhost is created with an empty password !
命令进去后可以修改密码。
发表评论