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)會提示你輸入密碼。輸入密碼后按回車即可登錄。
Step2 嘗試找到my.ini文件的路徑
show variables like 'datadir';

但是該目錄下根本就沒有my.ini配置文件
新建my.ini文件
Step 1 在桌面新建一個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文件夾,需要創(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,右鍵,選擇“重新啟動”

查看 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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MySQL表的CURD操作(數(shù)據(jù)的增刪改查)
數(shù)據(jù)庫本質(zhì)上是一個文件系統(tǒng),通過標(biāo)準(zhǔn)的SQL語句對數(shù)據(jù)進(jìn)行CURD操作,下面這篇文章主要給大家介紹了關(guān)于MySQL表的CURD操作的相關(guān)資料,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-02-02
Mysql查詢語句如何實現(xiàn)無限層次父子關(guān)系查詢
這篇文章主要介紹了Mysql查詢語句如何實現(xiàn)無限層次父子關(guān)系查詢問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-07-07

