您好,登錄后才能下訂單哦!
這篇文章主要介紹“Mysql應(yīng)用安裝后找不到my.ini文件如何解決”,在日常操作中,相信很多人在Mysql應(yīng)用安裝后找不到my.ini文件如何解決問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”Mysql應(yīng)用安裝后找不到my.ini文件如何解決”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
我在兩臺(tái)電腦上安裝了MySQL Server 8.0,準(zhǔn)備繼續(xù)做主從配置,這時(shí)候就需要用到my.ini文件進(jìn)行配置,但是我找不到my.ini文件。
我的安裝目錄中沒有my.ini文件。(這里我的mysql安裝目錄為C:\Program Files\MySQL\MySQL Server 8.0)。
那么我們就需要重新配置一下。
因?yàn)槲业膍ysql已經(jīng)用了一段時(shí)間,我這里就刪除服務(wù)重新配置。
刪除方法。
進(jìn)入mysql安裝的bin目錄。在路徑欄輸入cmd命令,即可進(jìn)入命令提示符。
查看我們mysql服務(wù)的名字。(可以看到這里我們的服務(wù)名字是MySQLD514,服務(wù)名是自定義的,每個(gè)人的情況可能不一樣,要自己插。)
命令如下:
# 刪除已安裝的mysql服務(wù) sc delete MySQLD514
# 初始化mysql mysqld --initialize-insecure --user=mysql
在bin文件夾同級(jí)目錄,新建my.ini文件。
將下面腳本復(fù)制到 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. basedir = D:\MySQL datadir = D:\MySQL\data port = 3306 server_id = 1 # 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
輸入命令 ,意思是創(chuàng)建一個(gè)名字為MySql的服務(wù),相關(guān)配置文件為C:\Program Files\MySQL\MySQL Server 8.0\my.ini
# 創(chuàng)建mysql服務(wù) mysqld --install "MySql" --defaults-file="C:\Program Files\MySQL\MySQL Server 8.0\my.ini"
再次打開服務(wù),即可看到我們的MySql服務(wù)項(xiàng)。
可以在服務(wù)中直接啟動(dòng),也可以在cmd中命令啟動(dòng)。命令為:
net start MySql
在bin目錄啟動(dòng)cmd。輸入下命令。
mysql -u root -p
這時(shí)密碼為空,不需要填寫,直接回車:
設(shè)置root用戶密碼為123456
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
設(shè)置退出,再次登錄,即可。
到此,關(guān)于“Mysql應(yīng)用安裝后找不到my.ini文件如何解決”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。