Add new mysql to wamp server manually

Here are the steps to add a new MySQL database to WAMP server manually:

Step 1: Stop the MySQL service

Stop the MySQL service by going to the WAMP icon in the system tray, clicking on it, and selecting "Stop MySQL".

Step 2: Create a new MySQL configuration file

Create a new file called my-new-config.ini in the C:\wamp\bin\mysql\mysql5.6.25\my.cnf directory (the exact path may vary depending on your WAMP version). This file will contain the configuration settings for the new MySQL database.

Step 3: Edit the new configuration file

Open the my-new-config.ini file in a text editor and add the following lines:

[mysqld]
port = 3306
socket = C:/wamp/tmp/mysql.sock
basedir = C:/wamp/bin/mysql/mysql5.6.25
datadir = C:/wamp/mysql/data
tmpdir = C:/wamp/mysql/tmp

These settings are similar to the default settings in the original my.cnf file, but you can adjust them as needed.

Step 4: Create a new MySQL data directory

Create a new directory called data in the C:\wamp\mysql directory. This will be the data directory for the new MySQL database.

Step 5: Create a new MySQL socket file

Create a new file called mysql.sock in the C:\wamp\tmp directory. This file will be used by the new MySQL database to communicate with the MySQL server.

Step 6: Start the MySQL service

Start the MySQL service by going to the WAMP icon in the system tray, clicking on it, and selecting "Start MySQL".

Step 7: Create a new MySQL database

Open a command prompt and navigate to the C:\wamp\bin\mysql\mysql5.6.25\bin directory. Run the following command to create a new MySQL database:

mysql -uroot -p<password> -e "CREATE DATABASE mynewdb"

Replace <password> with the root password you set for your WAMP installation.

Step 8: Grant privileges to the new database

Run the following command to grant privileges to the new database:

mysql -uroot -p<password> -e "GRANT ALL PRIVILEGES ON mynewdb.* TO 'mynewuser'@'%' IDENTIFIED BY 'mypassword'"

Replace <password> with the root password you set for your WAMP installation, and mynewuser and mypassword with the desired username and password for the new database.

Step 9: Test the new database

Open a command prompt and navigate to the C:\wamp\bin\mysql\mysql5.6.25\bin directory. Run the following command to test the new database:

mysql -u mynewuser -pmypassword mynewdb

If everything is set up correctly, you should be able to connect to the new database and run SQL queries.

That's it! You have successfully added a new MySQL database to your WAMP server manually.