DEV Community

codeek
codeek

Posted on

🚀 How to Find or Change XAMPP MySQL Username and Password in Windows

If you're using XAMPP for local web development, you'll often need your MySQL username and password to connect applications like PHP, Laravel, Node.js, or React. By default, XAMPP uses the root user with an empty password, but you can easily change it for better security.

Prerequisites

  • XAMPP installed on Windows
  • MySQL service running
  • phpMyAdmin accessible

Step 1: Start MySQL

  1. Open XAMPP Control Panel.
  2. Click Start next to MySQL.

Step 2: Open phpMyAdmin

Navigate to:

http://localhost/phpmyadmin
Enter fullscreen mode Exit fullscreen mode

Step 3: Find the Current Username

Open the User Accounts tab to view all MySQL users.

Default credentials:

Username: root
Password: (empty)
Enter fullscreen mode Exit fullscreen mode

Step 4: Change the MySQL Password

  1. Click User Accounts.
  2. Select Change password for the root user.
  3. Enter a new password.
  4. Click Go to save.

Step 5: Update phpMyAdmin Configuration

Open:

C:\xampp\phpMyAdmin\config.inc.php
Enter fullscreen mode Exit fullscreen mode

Update the password:

$cfg['Servers'][$i]['password'] = 'YourNewPassword';
Enter fullscreen mode Exit fullscreen mode

Save the file and restart MySQL.

Step 6: Update Your Application

Example .env configuration:

DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=my_database
DB_USERNAME=root
DB_PASSWORD=YourNewPassword
Enter fullscreen mode Exit fullscreen mode

Forgot the Root Password?

If you forget your MySQL root password, you can reset it using MySQL's recovery mode or the skip-grant-tables method.

Best Practices

  • Use a strong password.
  • Store credentials in environment variables.
  • Create separate users for different projects.
  • Never commit passwords to Git.

Conclusion

Changing your XAMPP MySQL password is straightforward and helps secure your local development environment. Remember to update both phpMyAdmin and your application's database configuration after changing the password.


📺 Video Tutorial

Watch the complete step-by-step tutorial:

How to Find or Change XAMPP MySQL Username and Password (Windows)

https://www.youtube.com/watch?v=XezG33DdEQ8


🚀 Build a Complete Modern E-Commerce Application

If you're looking to master full-stack e-commerce development, check out the complete playlist where we build everything from scratch using modern technologies.

Topics Covered
⚛️ React + Vite
🎨 Chakra UI
🛒 Shopping Cart
🔄 React Query (TanStack Query)
🌐 Axios
📦 Zustand
💳 Stripe Payment Integration
🚀 Deployment
📁 Clean Project Structure
🔥 Best Practices
🎥 Complete E-Commerce Playlist

https://www.youtube.com/watch?v=Jluy-W9eP-4&list=PL_02r0p8Ku_6tR8L-n-yj7MW8rrMtswwk&index=1

If you enjoy practical, real-world React tutorials, consider following the series for more production-ready projects and modern development techniques.

Happy coding! 🚀

Top comments (0)