So you’ve migrated to a new database server, or a new web server, or you’ve added a new database server to your cluster. The problem is, all of your mySQL users only have grants on the old server. Luckily, the guys at cPanel know your pain and have added an easy way to make sure all of your users have access to their databases.
Add the new hostname
- Back up the “mysql” database before making ANY changes.
- Log in to WHM as root
- Navigate to SQL Services->Additional SQL Access Hosts
- Put the new IP address that you’ll be accessing FROM in the box
If you’ve got a deadline, you can add the host % here – this will allow access to mySQL from all hosts. SQL authentication is still required, so you’re not exposing any passwords, but if your clients use insecure mySQL usernames, passwords, and database prefixes, this could still leave you open to a huge SQL injection vulnerability risk, so it is highly not recommended.
Add the grants
- Navigate back to the Additional SQL Access Hosts page, and at the bottom of the page, click the link labeled “click here.”
- Wait for the process to finish and confirm access.
This quick-and-dirty method will ensure your users will still be able to authenticate using their same passwords, and saves a lot of nasty mySQL batch work.