ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
Main Menu
Tweet
Facebook
Line
:-?
フラット表示 前のトピック | 次のトピック
投稿者 スレッド
webadm
投稿日時: 2022-3-14 0:23
Webmaster
登録日: 2004-11-7
居住地:
投稿: 3086
Re: PHP4からMariaDBに接続できない件
Oracleのダウンロードページからcommunity版(GPL)の古いMySQL 5.7というのがダウンロードできたので導入してみた。

最新のMySQLと違ってメモリフットプリントが小さいのかすんなり起動した。

しかし問題が、mysqlコマンドでさえも接続できないのである。

確か最初に導入した際にパスワード設定を求められた記憶があるけど、それを入力してもだめぽ。

ログを見るとなにやら不審な内容が、

022-03-12T20:43:02.880030Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

2022-03-13T04:54:08.891746Z 0 [Warning] User entry 'root'@'localhost' has a deprecated pre-4.1 password. The user will be ignored and no one can login with this user anymore.

( ´゚д゚`)えーーー

よく見ると続きがあった。

2022-03-13T04:54:08.891779Z 0 [Warning] Some of the user accounts with SUPER privileges were disabled because of empty mysql.user.plugin value. If you are upgrading from MySQL 5.6 to MySQL 5.7 it means we were not able to substitute for empty plugin column. Probably because of pre 4.1 password hash. If your account is disabled you will need to:
2022-03-13T04:54:08.891785Z 0 [Warning] 1. Stop the server and restart it with --skip-grant-tables.
2022-03-13T04:54:08.891789Z 0 [Warning] 2. Run mysql_upgrade.
2022-03-13T04:54:08.891793Z 0 [Warning] 3. Restart the server with the parameters you normally use.
2022-03-13T04:54:08.891806Z 0 [Warning] For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual

ふむ解決方法があるぽいな。

やってみたら、ちょっとやり方が違った。

1. Stop the server

sudo systemctl stop mysql.service

これはいいとして次ぎの

and restart it with --skip-grant-tables.

簡単に一言で済ませているけど具体的にはもっと込み入っている。

sudo vi /lib/systemd/system/mysql.service

でエディタで開いて

ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

という行を見つけて

ExecStart=/usr/sbin/mysqld --skip-grant-tables --daemonize --pid-file=/var/run/mysqld/mysqld.pid

という具合に --skip-grant-tables を挿入する。

これでエディタを閉じるだけでは不十分で、前の内容は現在動作しているsystemdが覚えて居るので、再度ファイルから読み直して覚えてもらう必要がある。

それをしないと、次ぎに mysql.serviceをstartさせると怒られる

Warning: The unit file, source configuration file or drop-ins of mysql.service changed on disk. Run 'systemctl daemon-reload' to reload units.

なので、systemd用のスクリプトを変更した場合には、それをバックグラウンドで走行中のsystemdに反映させるために、

sudo systemctl daemon-reload

を実行する必要があった。

この後で

sudo systemctl start mysql.service

を実行すると、mysqlで接続できることを確認。

root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# systemctl start mysql.service
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# ps -e |grep mysql
171347 ? 00:00:00 mysqld
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# cat /proc/171347/cmdline
/usr/sbin/mysqld--skip-grant-tables--daemonize--pid-file=/var/run/mysqld/mysqld.pidroot@ip-172-26-8-53:/home/ubuntu/rainbowseeker# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> exit;
Bye
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker#

まてよこのままでもよくね?

セキュリティ上は良くないが。

とりあえずPHP4から試してみたが、結果は変わらず(´Д`;)

やっぱ新しい認証方式にPHP側を対応させないと無理ぽい。

とりあえず残りの手順

2022-03-13T04:54:08.891789Z 0 [Warning] 2. Run mysql_upgrade.

root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# mysql_upgrade
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
The sys schema is already up to date (version 1.5.2).
Checking databases.
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.

ふむなんとも無いみたいだけど。

これでmysqldの起動パラメータを元に戻してもいいのかな?

root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# vi /lib/systemd/system/mysql.service
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# systemctl daemon-reload
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# systemctl stop mysql.service
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# systemctl start mysql.service
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> exit;
Bye
root@ip-172-26-8-53:/home/ubuntu/rainbowseeker#

ああ、直ったわ。

しかし依然として、PHPからは接続できないな。

022-03-13T06:34:07.559020Z 4 [Note] Bad handshake

まあ、これはPHPのバージョン如何に関わらず共通するらしい。

だからPHPはもうだめだと言われているのかも。

対策考え中...

フラット表示 前のトピック | 次のトピック

題名 投稿者 日時
   本サーバーのAWS移行 webadm 2022-3-8 1:26
     MySQLからMariaDBへの移行 webadm 2022-3-8 5:45
       Re: MySQLからMariaDBへの移行 webadm 2022-3-8 6:10
         Re: MySQLからMariaDBへの移行 webadm 2022-3-8 6:44
           Re: MySQLからMariaDBへの移行 webadm 2022-3-8 7:01
             Re: MySQLからMariaDBへの移行 webadm 2022-3-8 21:41
               AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 21:47
                 Re: AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 22:18
                   AWS Lightsailのブラウザssh端末の罠 webadm 2022-3-8 22:31
                   Re: AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 22:37
                     Re: AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 22:40
                       Re: AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 22:44
                         Re: AWS Ubuntu20.04でMariaDBが起動しない訳 webadm 2022-3-8 22:50
                           現行サーバーのwebコンテンツ転送 webadm 2022-3-12 11:42
                             XOOPS CMSの動作テスト webadm 2022-3-13 11:25
                               PHP4からMariaDBに接続できない件 webadm 2022-3-13 13:39
                                 Re: PHP4からMariaDBに接続できない件 webadm 2022-3-13 14:04
                                 » Re: PHP4からMariaDBに接続できない件 webadm 2022-3-14 0:23
                                     Re: PHP4からMariaDBに接続できない件 webadm 2022-3-14 2:15
                                       遂にAWS上で現行サーバーのXOOPS CMSが動いた webadm 2022-3-14 4:17
                                         メールサーバーと旧コンテンツ webadm 2022-3-17 16:04
                                           300 USD 分の AWS 無料クレジットを申請できます webadm 2022-4-4 11:34

投稿するにはまず登録を
 
ページ変換(Google Translation)
サイト内検索