Answers for "mysql remote access"

SQL
1

mysql allow remote connections

#open /etc/mysql/mysql.conf.d/mysqld.cnf 
#and change
#bind-address            = 127.0.0.1
#to
#bind-address            = 0.0.0.0

#then grant root all privaleges to root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

#If you ran above command and accidently
#did not change password for root you can run this:
ALTER USER 'root'@'%' IDENTIFIED BY 'MyNewPass';
Posted by: Guest on February-29-2020
6

mysql remote connection command line

mysql --host=localhost --user=myname --password mydb
Posted by: Guest on February-18-2020
0

access mysql from remote

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     WITH GRANT OPTION;
mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     WITH GRANT OPTION;


#you need to change ufw for allowing 3306 port.

sudo ufw allow 3306

#if you are in aws ec2, you have to change the security group also
Posted by: Guest on August-15-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language