mysql8.0找不到my.ini配置文件的問題及解決
mysql 8.0找不到my.ini配置文件
“mysql 8.0 來了,該更新版本了”
為了方便日后的工作,在這里整理了一下mysql的基本配置
新建my.ini配置文件
有些時候需要設(shè)置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)
執(zhí)行結(jié)果就是配置文件的路徑
注:可以通過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
內(nèi)容可以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:\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,進(jìn)入命令行,輸入:
mysqld --defaults-file="C:\install\mysql\mysql-8.0.16-winx64\my.ini"
即修改mysql的配置文件路徑
嘿嘿 _
重啟mysql服務(wù)即可,查看是否生效,可以執(zhí)行類似的命令:
mysql> show variables like '%ft%'; +---------------------------------+----------------+ | Variable_name | Value | +---------------------------------+----------------+ | ft_boolean_syntax | + -><()~*:""&| | | ft_min_word_len | 1 | +---------------------------------+----------------+ 17 rows in set (0.03 sec)
如果還沒有安裝mysql服務(wù),那更加好,只需要在安裝的時候輸入即可:
mysqld --install "MySql80" --defaults-file="C:\install\mysql\mysql-8.0.16-winx64\my.ini"
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
mysql獲取group by的總記錄行數(shù)另類方法
mysql獲取group by內(nèi)部可以獲取到某字段的記錄分組統(tǒng)計總數(shù),而無法統(tǒng)計出分組的記錄數(shù),下面有個可行的方法,大家可以看看2014-10-10詳解MySQL中concat函數(shù)的用法(連接字符串)
本篇文章主要介紹了MySQL中concat函數(shù)的用法(連接字符串),在命令行模式下進(jìn)行測試。具有一定的參考價值,感興趣的小伙伴們可以參考一下。2016-12-12MySQL使用IF函數(shù)動態(tài)執(zhí)行where條件的方法
這篇文章主要介紹了MySQL使用IF函數(shù)來動態(tài)執(zhí)行where條件,詳細(xì)介紹了IF函數(shù)在WHERE條件中的使用,MySQL的IF()函數(shù),接受三個表達(dá)式,如果第一個表達(dá)式為true,而不是零且不為NULL,它將返回第二個表達(dá)式,需要的朋友可以參考下2022-09-09MySQL中大數(shù)據(jù)表增加字段的實現(xiàn)思路
最近遇到的一個問題,需要在一張將近1000萬數(shù)據(jù)量的表中添加加一個字段,但是直接添加會導(dǎo)致mysql 奔潰,所以需要利用其他的方法進(jìn)行添加,這篇文章主要給大家介紹了MySQL中大數(shù)據(jù)表增加字段的實現(xiàn)思路,需要的朋友可以參考借鑒。2017-01-01mysql 8.0.12安裝配置方法圖文教程(Windows版)
這篇文章主要為大家詳細(xì)介紹了Windows下mysql 8.0.12安裝配置方法圖文教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-08-08MySQL中列子查詢與行子查詢操作的學(xué)習(xí)教程
這篇文章主要介紹了MySQL中列子查詢與行子查詢操作的學(xué)習(xí)教程,子查詢是MySQL入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下2015-12-12