XAMMP的Mysql配置

參考 https://blog.csdn.net/qq_36595013/article/details/80373597#3%E9%85%8D%E7%BD%AEapache

        https://www.cnblogs.com/upwifi/p/4492261.html

        https://www.lmdouble.com/104432785.html


步驟一 打開XAMMP(即xampp-control.exe)

步驟二 點擊Mysql的“Config”按鈕,打開my.ini文件

 

步驟三 把my.ini中的3306改爲3316(如果3306不衝突,可以不修改)
             把my.ini中的字符集改爲utf8,原文檔中已有,但需要取消註釋(如果不配置utf8,取出的中文是亂碼).

改爲

步驟五 重啓,點擊Mysql的“start”按鈕,如果Mysql變成綠色就說明配置成功。


 

但是也可能出現以下錯誤。

第一種 錯誤

13:51:29  [mysql] Problem detected!

13:51:29  [mysql] Port 3306 in use by ""E:COMPUTERMysqlbinmysqld" --defaults-file="E:COMPUTERMysqlmy.ini" MySQL51"!

13:51:29  [mysql] MySQL WILL NOT start without the configured ports free!

13:51:29  [mysql] You need to uninstall/disable/reconfigure the blocking application

13:51:29  [mysql] or reconfigure MySQL and the Control Panel to listen on a different port

13:51:29  [mysql] Attempting to start MySQL app...

 第一種可能是由於系統的服務佔用了3306端口,要麼結束系統服務,要麼修改mysql端口【如果你前面已經修改了mysql端口就採用第二種解決方法】

第二種在xampp根目錄下有兩個個文件properties.ini和xampp-control.in

1、打開properties.ini,把紅色標註部分設置了其實端口,依次修改成mysql_port=3316     mysql_arguments=-u root -P3316

---------------------------------------------

[General]

installdir=D:\xampp

base_stack_name=XAMPP

base_stack_version=1.8.3-1

base_stack_platform=windows

require_root_privileges=1

[Apache]

apache_server_port=80

apache_server_ssl_port=443

apache_root_directory=/xampp/apache

apache_htdocs_directory=D:\xampp/htdocs

apache_domainname=127.0.0.1

apache_configuration_directory=D:\xampp/apache/conf

apache_unique_service_name=

[MySQL]

mysql_port=3306

mysql_host=localhost

mysql_root_directory=D:\xampp\mysql

mysql_binary_directory=D:\xampp\mysql\bin

mysql_data_directory=D:\xampp\mysql\data

mysql_arguments=-u root -P3306

mysql_unique_service_name=

[PHP]

php_binary_directory=D:\xampp\php

php_configuration_directory=D:\xampp\php

-------------------------------------------------------------

2.打開xampp-control.ini,把紅色標註部分設置了其實端口,依次修改成 MySQL=3316

-----------------------------------------------

[ServicePorts]

Apache=80

ApacheSSL=443

MySQL=3306

FileZilla=21

FileZillaAdmin=14147

Mercury1=25

Mercury2=79

Mercury3=105

Mercury4=106

Mercury5=110

Mercury6=143

Mercury7=2224

TomcatHTTP=8080

TomcatAJP=8009

Tomcat=8005

-------------------------------------------


第二種 錯誤【service啓動路徑出現了錯誤。】

12:35:23 [mysql] MySQL Service detected with wrong path

12:35:23 [mysql] Change XAMPP MySQL settings or

12:35:23 [mysql] Uninstall/disable the other service manually first

12:35:23 [mysql] Found Path: "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini" MySQL 12:35:23 [mysql] Expected Path: c:\xampp\mysql\bin\mysqld.exe --defaults-file=c:\xampp\mysql\bin\my.ini mysql

說明以前我有安裝過xampp,但在卸載的時候沒有卸載完全,雖然說把以前的安裝目錄等刪除掉了,但在註冊表中還有相關的信息殘留。通過定位註冊表的位置能夠看出有一條註冊表鍵值與錯誤提示中的路徑值相同,說明service啓動路徑出現錯誤的提示與這個有關係了

修改註冊表信息,參考我的另一篇博客https://blog.csdn.net/guqigongzi/article/details/106503259

 

10:30:09 PM  [mysql]    Port 3306 in use by ""C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini" MySQL"!
10:30:09 PM  [mysql]    MySQL WILL NOT start without the configured ports free!
10:30:09 PM  [mysql]    You need to uninstall/disable/reconfigure the blocking application
10:30:09 PM  [mysql]    or reconfigure MySQL and the Control Panel to listen on a different port
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章