Last active
January 16, 2023 15:25
-
-
Save karson/2aa7abf9bbf0d920de76b3b71c354fd9 to your computer and use it in GitHub Desktop.
Allow remote access to existing user in Mysql Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #for new user | |
| CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; | |
| CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; | |
| GRANT ALL ON *.* TO 'myuser'@'localhost'; | |
| GRANT ALL ON *.* TO 'myuser'@'%'; | |
| FLUSH PRIVILEGES; | |
| #For existing users | |
| #This grants root access with the same password from any machine in *.example.com: | |
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.example.com' | |
| IDENTIFIED BY 'some_characters' | |
| WITH GRANT OPTION; | |
| FLUSH PRIVILEGES; | |
| #If name resolution is not going to work, you may also grant access by IP or subnet: | |
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%' | |
| IDENTIFIED BY 'some_characters' | |
| WITH GRANT OPTION; | |
| FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment