MySQL 8.0找不到 my.ini 配置文件(并開啟 Binlog 監(jiān)聽)
使用管理員權(quán)限打開cmd(命令提示符)
Step1 win+R

Step2 輸入 cmd

Step3 Ctrl+Shift+Enter

嘗試找到my.ini配置文件路徑
Step1 打開 MySQL
mysql -u 用戶名 -p
-u 后面跟的是 MySQL 用戶名(如 root)。
-p 表示需要輸入密碼。
輸入命令后,按回車鍵,系統(tǒng)會(huì)提示你輸入密碼。輸入密碼后按回車即可登錄。
Step2 嘗試找到my.ini文件的路徑
show variables like 'datadir';

但是該目錄下根本就沒有my.ini配置文件
新建my.ini文件
Step 1 在桌面新建一個(gè)txt文件
我的C:\Program Files\MySQL\MySQL Server 8.0下只能創(chuàng)建文件夾,所以要在別的地方創(chuàng)建空的my.ini文件

Step 2 修改txt文件為ini文件
通過重命名的方式將txt文件修改為int文件 “新建 文本文檔.txt” -> “my.ini”

打開 my.ini,復(fù)制以下內(nèi)容到 my.ini
# 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. lc-messages-dir = C:\\Program Files\\MySQL\\MySQL Server 8.0\\share basedir = C:\\Program Files\\MySQL\\MySQL Server 8.0 datadir = C:\\Program Files\\MySQL\\MySQL Server 8.0\\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 log-bin=mysql-bin # 開啟 binlog binlog-format=ROW # 選擇 ROW 模式 server_id=1 # 配置 MySQL replaction 需要定義,不要和 canal 的 slaveId 重復(fù)
注:替換為你電腦的路徑(如果沒有Data文件夾,需要?jiǎng)?chuàng)建好)

Step 3 修改mysql的配置文件路徑
打開cmd,進(jìn)入命令行,輸入(注:替換為你電腦的路徑):
mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 8.0\my.ini"
重啟 MySQL 服務(wù)
打開任務(wù)管理器
打開任務(wù)管理器,選擇“服務(wù)”

重啟 MySQL 服務(wù)
找到 MySQL,右鍵,選擇“重新啟動(dòng)”

查看 Binlog 日志是否開啟
執(zhí)行 MySQL 執(zhí)行命令查看 Binlog 日志是否開啟。
show variables like 'log_%';
如果查詢出的選型 log_bin 數(shù)據(jù)為 ON,Binlog 即為開啟狀態(tài)。輸出如下:

到此這篇關(guān)于MySQL 8.0找不到 my.ini 配置文件(并開啟 Binlog 監(jiān)聽)的文章就介紹到這了,更多相關(guān)MySQL 8.0找不到 my.ini 內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Mysql字段為NULL時(shí)是否會(huì)導(dǎo)致索引失效
這篇文章主要介紹了Mysql字段為NULL時(shí)是否會(huì)導(dǎo)致索引失效的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2025-05-05
MySQL表的CURD操作(數(shù)據(jù)的增刪改查)
數(shù)據(jù)庫(kù)本質(zhì)上是一個(gè)文件系統(tǒng),通過標(biāo)準(zhǔn)的SQL語(yǔ)句對(duì)數(shù)據(jù)進(jìn)行CURD操作,下面這篇文章主要給大家介紹了關(guān)于MySQL表的CURD操作的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-02-02
Mysql查詢語(yǔ)句如何實(shí)現(xiàn)無(wú)限層次父子關(guān)系查詢
這篇文章主要介紹了Mysql查詢語(yǔ)句如何實(shí)現(xiàn)無(wú)限層次父子關(guān)系查詢問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07
MYSQL造數(shù)據(jù)占用臨時(shí)表空間的解決方法
在MySQL中,臨時(shí)表空間并不是一個(gè)可以直接刪除的文件或目錄,因?yàn)榕R時(shí)表空間通常是由MySQL服務(wù)器在運(yùn)行時(shí)根據(jù)需要自動(dòng)創(chuàng)建和管理的,這篇文章主要介紹了MYSQL造數(shù)據(jù)占用臨時(shí)表空間,需要的朋友可以參考下2024-05-05
mysql高級(jí)語(yǔ)句的查詢語(yǔ)句使用及說明
文章主要講解了SQL中排序語(yǔ)法、區(qū)間判斷、分組查詢、偏移量limit、別名as、表復(fù)制、通配符like、子查詢、existsexists、視圖、連接查詢等知識(shí)點(diǎn)及其用法和示例,對(duì)SQL查詢和操作進(jìn)行了詳細(xì)說明2026-05-05

