如何同时运行本地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/binor/opt/ampps/mysql/bin. - Open
my.ini(ormy.cnf) with a text editor (Notepad++, VS Code, nano—whatever you prefer). - Find the line that says
port = 3306and change it to an unused port like3307(any port above 1024 that isn't already in use works). - If you see a
socketline (common on Unix-like systems, sometimes present on Windows), you can rename it to something likesocket = mysql-ampps.sockto 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-configfolder (likemy-huge.iniormy-large.ini). Pop open any of these that have aport = 3306line and update it to3307too.
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
3306to3307to 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 usuallymysqlunless 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 :3307on Windows, orlsof -i :3307on 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
3307from now on.
内容的提问来源于stack exchange,提问作者Guillermo Teixeira
相关产品推荐
相关产品推荐

