You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何同时运行本地3306端口MySQL与AMPPS自带MySQL实例?

Got it, let's get your two MySQL instances up and running side by side without conflicts. The main hangup here is that both are trying to hog port 3306 by default—so we just need to reconfigure the AMPPS MySQL to use a different port. Here's how to do it step by step:

Step 1: Stop all running MySQL services first
  • First up, make sure your existing local MySQL server is either running (or stop it temporarily if you want—though we really just need AMPPS' MySQL instance shut down for now).
  • Open your AMPPS dashboard, head to the MySQL tab, and hit the Stop button to kill its MySQL process.
Step 2: Tweak AMPPS MySQL's config files

We need to update two key files to switch the port:

my.ini (or my.cnf, depending on your OS)

  • Navigate to your AMPPS MySQL directory. On Windows, this is usually C:\Program Files\Ampps\mysql\bin; on macOS/Linux, it might be /Applications/AMPPS/mysql/bin or /opt/ampps/mysql/bin.
  • Open my.ini (or my.cnf) with a text editor (Notepad++, VS Code, nano—whatever you prefer).
  • Find the line that says port = 3306 and change it to an unused port like 3307 (any port above 1024 that isn't already in use works).
  • If you see a socket line (common on Unix-like systems, sometimes present on Windows), you can rename it to something like socket = mysql-ampps.sock to avoid socket conflicts—though this is optional, it's a safe extra step.

Optional: Check additional config files

  • Some AMPPS setups have extra config files in the mysql\my-config folder (like my-huge.ini or my-large.ini). Pop open any of these that have a port = 3306 line and update it to 3307 too.
Step 3: Update AMPPS panel settings to match
  • Go back to the AMPPS dashboard's MySQL tab. Look for the "Port" field (it might be under Settings or Advanced options). Change it from 3306 to 3307 to align with your config file edits.
  • Save those settings—AMPPS needs to know the new port to manage the service correctly.
Step 4: Fire up both MySQL services
  • Start your original local MySQL server first (if you stopped it earlier). It should still listen on port 3306 like normal.
  • Then, head back to AMPPS' MySQL tab and hit Start. It should boot up without any port conflicts now, listening on 3307.
Step 5: Verify both instances are working
  • To check your local MySQL: Open a terminal/command prompt and run mysql -u root -P 3306 -p. Enter your local MySQL root password when prompted—you should connect successfully.
  • To check AMPPS MySQL: Run mysql -u root -P 3307 -p (the default AMPPS MySQL root password is usually mysql unless you changed it). If you can connect to both, you're golden!
Quick troubleshooting tips
  • If AMPPS MySQL won't start, double-check that you updated the port in all config files and the AMPPS panel. Also, confirm port 3307 isn't taken by another service—use netstat -ano | findstr :3307 on Windows, or lsof -i :3307 on macOS/Linux to check.
  • If you get socket errors, make sure the socket path in the config file matches what AMPPS expects.
  • Remember: Any apps or database clients connecting to the AMPPS MySQL instance will need to specify port 3307 from now on.

内容的提问来源于stack exchange,提问作者Guillermo Teixeira

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 06:54:04