Open zazazazazazazaz opened 4 years ago
create user 'root'@'%' identified by 'root';
alter user 'root'@"%" identified with mysql_native_password by '{password}';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;
mysql> SELECT host, user, plugin FROM mysql.user;
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | caching_sha2_password |
+-----------+------------------+-----------------------+
5 rows in set (0.00 sec)
/var/log/mysql/error.log
2019-12-07T04:51:42.062860Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.18) starting as process 484
2019-12-07T04:51:43.130712Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-12-07T04:51:43.199046Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.18' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2019-12-07T04:51:43.260778Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2019-12-07T06:14:18.880524Z 8 [Warning] [MY-010055] [Server] IP address '192.168.0.101' could not be resolved: Name or service not known
2019-12-07T06:43:21.650478Z 15 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
2019-12-07T06:43:44.980830Z 16 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
mysql> show variables like '%ssl%';
+--------------------+-----------------+
| Variable_name | Value |
+--------------------+-----------------+
| have_openssl | YES |
| have_ssl | YES |
| mysqlx_ssl_ca | |
| mysqlx_ssl_capath | |
| mysqlx_ssl_cert | |
| mysqlx_ssl_cipher | |
| mysqlx_ssl_crl | |
| mysqlx_ssl_crlpath | |
| mysqlx_ssl_key | |
| ssl_ca | ca.pem |
| ssl_capath | |
| ssl_cert | server-cert.pem |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_fips_mode | OFF |
| ssl_key | server-key.pem |
+--------------------+-----------------+
17 rows in set (0.00 sec)
クライアント側はdisableになってるやんけ
mysql> show variables like '%ssl%';
+---------------+--------------------------------+
| Variable_name | Value |
+---------------+--------------------------------+
| have_openssl | DISABLED |
| have_ssl | DISABLED |
| ssl_ca | /var/lib/mysql/ca.pem |
| ssl_capath | |
| ssl_cert | /var/lib/mysql/server-cert.pem |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | /var/lib/mysql-server-key.pem |
+---------------+--------------------------------+
9 rows in set (0.01 sec)
次はこれ
root@mysql-client:/etc/mysql# mysql -uroot -p -h 192.168.0.100 --ssl-ca=/var/lib/mysql/ca.pem
Enter password:
ERROR 2026 (HY000): SSL connection error: ASN: bad other signature confirmation
クライアントとサーバで ca.pem
が違ったので合わせた
ERROR 1045 (28000): Access denied for user 'root'@'192.168.0.101' (using password: YES)
厳しい
# mysql -uroot -p -h 192.168.0.100 --ssl-ca=/var/lib/mysql/ca.pem --ssl-cert=/var/lib/mysql/server-cert.pem --ssl-key=/var/lib/mysql/server-key.pem
Enter password:
ERROR 2026 (HY000): SSL connection error: unknown error number
諦め
先輩がMySQLサーバを立てて、新しく運用を開始したらしい。
そのサーバを利用するため、rootパスワードを教えて貰ったため、今までどおりのログインコマンドを試してみた。
$ mysql -uroot -p -h 192.168.0.100 だが、なぜかログインエラーが出てしまい先輩のサーバにアクセスできない。先輩はサーバ上で正しく動いているらしいので、トラブルシューティングのためにそのサーバへのアクセス権限をもらった。
クライアントサーバから上記のコマンドを実行し、rootユーザがログインできるように変更を加え、下記の内容を報告してほしい。
ログインできるようになるためどのような作業を行ったのか なぜログインが行えなかったのか 問題サーバー クライアント
IPアドレス: 192.168.0.101 ユーザー: admin パスワード: USerPw@19 サーバ
IPアドレス: 192.168.0.100 ユーザー: admin パスワード: USerPw@19 DBユーザー: root DBパスワード: root