欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL 8.0找不到 my.ini 配置文件(并開(kāi)啟 Binlog 監(jiān)聽(tīng))

 更新時(shí)間:2025年06月11日 10:11:09   作者:追風(fēng)趕月莫停留-_-  
本文主要介紹了MySQL 8.0找不到 my.ini 配置文件(并開(kāi)啟 Binlog 監(jiān)聽(tīng)),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

使用管理員權(quán)限打開(kāi)cmd(命令提示符)

Step1 win+R

在這里插入圖片描述

Step2 輸入 cmd

在這里插入圖片描述

Step3 Ctrl+Shift+Enter

在這里插入圖片描述

嘗試找到my.ini配置文件路徑

Step1 打開(kāi) MySQL

 mysql -u 用戶名 -p

-u 后面跟的是 MySQL 用戶名(如 root)。
-p 表示需要輸入密碼。

輸入命令后,按回車鍵,系統(tǒng)會(huì)提示你輸入密碼。輸入密碼后按回車即可登錄。

Step2 嘗試找到my.ini文件的路徑

 show variables like 'datadir';

在這里插入圖片描述

但是該目錄下根本就沒(méi)有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文件

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

在這里插入圖片描述

打開(kāi) 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 # 開(kāi)啟 binlog
binlog-format=ROW # 選擇 ROW 模式
server_id=1 # 配置 MySQL replaction 需要定義,不要和 canal 的 slaveId 重復(fù)

注:替換為你電腦的路徑(如果沒(méi)有Data文件夾,需要?jiǎng)?chuàng)建好)

在這里插入圖片描述

Step 3 修改mysql的配置文件路徑

打開(kāi)cmd,進(jìn)入命令行,輸入(注:替換為你電腦的路徑):

mysqld  --defaults-file="C:\Program Files\MySQL\MySQL Server 8.0\my.ini"

重啟 MySQL 服務(wù)

打開(kāi)任務(wù)管理器

打開(kāi)任務(wù)管理器,選擇“服務(wù)”

在這里插入圖片描述

重啟 MySQL 服務(wù)

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

在這里插入圖片描述

查看 Binlog 日志是否開(kāi)啟

執(zhí)行 MySQL 執(zhí)行命令查看 Binlog 日志是否開(kāi)啟。

show variables like 'log_%';

如果查詢出的選型 log_bin 數(shù)據(jù)為 ON,Binlog 即為開(kāi)啟狀態(tài)。輸出如下:

在這里插入圖片描述

到此這篇關(guān)于MySQL 8.0找不到 my.ini 配置文件(并開(kāi)啟 Binlog 監(jiān)聽(tīng))的文章就介紹到這了,更多相關(guān)MySQL 8.0找不到 my.ini 內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

最新評(píng)論