📜  从远程访问 mysql - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:57.804000             🧑  作者: Mango

代码示例1
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