官网地址:https://www.mysql.com/
注意:my.ini文件的编码必须是英文编码(如windows中的ANSI),不能是UTF-8或GBK等。
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/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. [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_bin init_connect='SET NAMES utf8mb4' # 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=D:\JavaStudy\software\mysql-8.0.24-winx64 datadir=D:\\JavaStudy\\software\\mysql-8.0.24-winx64\\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 = 16M read_rnd_buffer_size = 16M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
如果安装错了,可执行sc delete mysql删除mysql重新 安装
在mysql5.7以上版本中默认没有一个data目录,即没有初始化服务。需要先初始化mysql才可以启动服务,否则会报 “服务没有报告任何错误”,启动失败呗。
正确的步骤是:先在mysql的bin目录下执行mysqld --initialize (不设置root密码,建议使用)命令,第一次执行这个命令会等待的时间稍微长了一些,并且控制台没有任何返回结果。可以看到mysql的根目录下会多出一个data文件夹,里面一堆文件。
安装MySQL的时候,当我们用命令mysqld --initialize --console进行初始化时,会出现mysqld: Can’t create directory ‘D:\Devsoft\mysql-8.0.20-winx64\bin\ oftWare\MySQL\data’ (OS errno 2 - No such file or directory)
解决方法
可以更改文件夹的名称,但是不建议,因为"“和其它字符在一起也有可能有特定含义,所有,我们直接用\,从而直接转义”"含义。