-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathAccess-MySQL-Over_internet.txt
More file actions
41 lines (29 loc) · 1.1 KB
/
Access-MySQL-Over_internet.txt
File metadata and controls
41 lines (29 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Change MYSQL Default Authentication type (Caching_sha2_password is default)
$ nano /etc/mysql/my.cnf
# for mysql_native_password
[mysqld]
default-authentication-plugin=mysql_native_password
# for caching_sha2_password
[mysqld]
default-authentication-plugin=caching_sha2_password
To check if you have done it right
$ sudo mysql
SHOW VARIABLES LIKE 'default_authentication_plugin';
==========================================
Caching_sha2_password User
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Change bind-address to the 0.0.0.0
bind-address = 0.0.0.0
$ sudo mysql
CREATE USER 'user_name'@'%' IDENTIFIED WITH caching_sha2_password BY 'password';
GRANT ALL PRIVILEGES ON `database_name`.* TO 'user_name'@'%';
FLUSH PRIVILEGES;
=========================================
Non caching_sha2_password User
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Change bind-address to the 0.0.0.0
bind-address = 0.0.0.0
$ sudo mysql
CREATE USER 'database_name'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON `database_name`.* TO 'user_name'@'%';
FLUSH PRIVILEGES;