Created
January 10, 2021 18:53
-
-
Save memandip/38c51bdc240b00c8a4b88eae48d84f5f to your computer and use it in GitHub Desktop.
Allow remote connections to remote mysql server
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
1. vim /etc/mysql/mysql.conf.d/mysqld.cnf or /etc/mysql/my.cnf | |
2. Add following code to any one of above file | |
[mysqld] | |
pid-file = /var/run/mysqld/mysqld.pid | |
socket = /var/run/mysqld/mysqld.sock | |
datadir = /var/lib/mysql | |
log-error = /var/log/mysql/error.log | |
bind-address = 0.0.0.0 | |
// allow from any host | |
3. CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; | |
// for specific host | |
4. CREATE USER 'username'@'192.168.1.100' IDENTIFIED WITH mysql_native_password BY 'password'; | |
5. Grant privileges to db | |
GRANT ALL ON *.* to username@‘192.168.1.100’ IDENTIFIED BY 'password’; | |
6. Flush privileges; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment