C:\Program Files\MySQL\MySQL Workbench 6.3 CE> mysql -h 203.0.113.1 -u root -P 3306 -p
Enter password: ****************************************************************
ERROR 2003 (HY000): Can't connect to MySQL server on '203.0.113.1' (10060)
しかし、エラーする。
まあ、当然だ。
Windows VPS側でMySQLのrootユーザーにリモート接続許可する
Windows VPSにリモートデスクトップ接続して、mysqlにログインする。
C:\Program Files\MySQL\MySQL Workbench 6.3 CE> mysql -u root -p [ENTER]Enter password: ここにパスワードをコピペで貼り付ける。[ENTER]
mysql>
mysql> select user,host from mysql.user;
+-----------+-----------+
| user | host |
+-----------+-----------+
| mysql.sys | localhost |
| root | localhost |
+-----------+-----------+
2 rows in set (0.00 sec)
mysql>
mysql> GRANT ALL privileges ON *.* TO root@"10.10.%" identified by 'rootのパスワード' WITH GRANT OPTION;
上のコマンドが成功して何かメッセージが出たがキャプチャーし忘れた。
mysql> select user,host from mysql.user;
+-----------+-----------+| user | host |
+-----------+-----------+
| root | 10.10.% |
| mysql.sys | localhost |
| root | localhost |
+-----------+-----------+
3 rows in set (0.00 sec)
drop user 'root'@'10.10.%';
create user 'root'@'10.10.%' identified with mysql_native_password by 'このユーザーのpasswordを入れる';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.10.%' WITH GRANT OPTION;
C:\Program Files\MySQL\MySQL Workbench 6.3 CE>mysql -h 203.0.113.1 -u root -P 3306 -p
Enter password: ****************************************************************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
コメント