mysql8.0不到my.ini配置⽂件解决⽅案“mysql 8.0 来了,该更新版本了”
  为了⽅便⽇后的⼯作,在这⾥整理了⼀下mysql的基本配置
新建my.ini配置⽂件
有些时候需要设置mysql的属性,⼀般的可以通过以下⽅式到my.ini⽂件的路径
mysql> show variables like 'datadir';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| datadir      | C:\ProgramData\MySQL\MySQL Server 8.0\ |
+---------------+--------------------------------------------+
1 row in set (0.03 sec)
执⾏结果就是配置⽂件的路径
注:可以通过select @@basedir; 获取到mysql的安装路径
但是笔者的mysql有点傲娇,不太⼀样:
mysql> show variables like 'datadir';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| datadir      | C:\install\mysql\mysql-8.0.16-winx64\data\ |
+---------------+--------------------------------------------+
1 row in set (0.03 sec)
并且该⽬录下根本就没有my.ini配置⽂件。。。。。
嘿嘿~~ 那就新建⼀个!
⽐如在这⾥新建⼀个空的my.ini:
C:\install\mysql\mysql-8.0.16-winx64\my.ini
内容可以copy⼀份这⾥的:
# For advice on how to change settings please see
# sql/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
mysql下载配置# *** 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,else10%. 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:\MySQL
datadir = D:\MySQL\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
或者只加⼊⾃⼰想要的配置,例如:
[mysqld]
ft_min_word_len=1
然后打开cmd,进⼊命令⾏,输⼊:
mysqld  --defaults-file="C:\install\mysql\mysql-8.0.16-winx64\my.ini"
_
即修改mysql的配置⽂件路径,嘿嘿
重启mysql服务即可,查看是否⽣效,可以执⾏类似的命令:
mysql>  show variables like '%ft%';
+---------------------------------+----------------+
| Variable_name                  | Value          |
+---------------------------------+----------------+
| ft_boolean_syntax              |+-><()~*:""&||
| ft_min_word_len                |1|
+---------------------------------+----------------+
17 rows in set (0.03 sec)
如果还没有安装mysql服务,那更加好,只需要在安装的时候输⼊即可:mysqld --install "MySql80"--defaults-file="C:\install\mysql\mysql-8.0.16-winx64\my.ini"

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。