概述
“mysql 8.0 来了,该更新版本了”
为了方便日后的工作,在这里整理了一下mysql的基本配置
新建my.ini配置文件
有些时候需要设置mysql的属性,一般的可以通过以下方式找到my.ini文件的路径
mysql> show variables like 'datadir';
+---------------+--------------------------------------------+
| Variable_name | Value
|
+---------------+--------------------------------------------+
| datadir
| C:ProgramDataMySQLMySQL Server 8.0 |
+---------------+--------------------------------------------+
1 row in set (0.03 sec)
执行结果就是配置文件的路径
注:可以通过select @@basedir; 获取到mysql的安装路径
但是笔者的mysql有点傲娇,不太一样:
mysql> show variables like 'datadir';
+---------------+--------------------------------------------+
| Variable_name | Value
|
+---------------+--------------------------------------------+
| datadir
| C:installmysqlmysql-8.0.16-winx64data |
+---------------+--------------------------------------------+
1 row in set (0.03 sec)
并且该目录下根本就没有my.ini配置文件。。。。。
嘿嘿~~ 那就新建一个!
比如在这里新建一个空的my.ini:
C:installmysqlmysql-8.0.16-winx64my.ini
内容可以copy一份这里的:
# 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:MySQL
datadir = D:MySQLdata
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:installmysqlmysql-8.0.16-winx64my.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:installmysqlmysql-8.0.16-winx64my.ini"
最后
以上就是难过棒棒糖为你收集整理的mysql 8.0找不到my.ini配置文件解决方案的全部内容,希望文章能够帮你解决mysql 8.0找不到my.ini配置文件解决方案所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复