'How do I give access to my partner to my local MySQL database?

My partner and I are using MySQL, Express, and Node while working with a database that is setup on my local machine using MySQL workbench. Below is the code I use to connect to the database.

const pool = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: '****',
    database: 'events',
    port: '3306'
})

We tried for a little bit to fix the issue but didn't figure it out before we agreed to meet tomorrow to try and get it to work.

Below is what I have come up with so far to see tomorrow if it fixes the issue:

  1. Added 'bind-address = 0.0.0.0' to the my.ini file directly underneath the [mysql] section
  2. Created a root2 user for my partner to use in place of root user in his connection code with host as % instead of localhost with command GRANT ALL PRIVILEGES ON events.* TO 'root2'@'%'; on the mysql command line
  3. Adjusted firewall settings to account for port 3306

Would the last step be to change my partner's host: 'localhost' to the ip address of my machine? Would it be easier/necessary for my partner to connect using MySQL workbench or does he need to download anything else for it to work?



Solution 1:[1]

  1. Check the error log for your MySQL server.
  2. Select the host user from mysql.user.
  3. Check your firewalld(linux), then shutdown. Check my.ini(windows) bind-address.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stewie Griffin