WSL2にnvidia-dockerを入れる
WSLでMySQLを再インストールすることにした
なんかもうにっちもさっちもいかなくなったので、再インストールすることにした。
削除。
qiita.com
MySQLが止まってなかったんで消えなかった。
$ sudo apt-get remove --purge mysql-server* mysql-common Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'mysql-server-5.5' for glob 'mysql-server*' Note, selecting 'mysql-server-5.6' for glob 'mysql-server*' Note, selecting 'mysql-server-5.7' for glob 'mysql-server*' Note, selecting 'mysql-server' for glob 'mysql-server*' Note, selecting 'mysql-server-8.0' for glob 'mysql-server*' Note, selecting 'mysql-server-core-5.5' for glob 'mysql-server*' Note, selecting 'mysql-server-core-5.6' for glob 'mysql-server*' Note, selecting 'mysql-server-core-5.7' for glob 'mysql-server*' Note, selecting 'mysql-server-core-8.0' for glob 'mysql-server*' Package 'mysql-server-5.5' is not installed, so not removed Package 'mysql-server-5.7' is not installed, so not removed Package 'mysql-server-core-5.7' is not installed, so not removed Package 'mysql-server-core-5.5' is not installed, so not removed Package 'mysql-server-core-5.6' is not installed, so not removed Package 'mysql-server-5.6' is not installed, so not removed Package 'mysql-server' is not installed, so not removed The following packages were automatically installed and are no longer required: libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.1-7 libevent-pthreads-2.1-7 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmecab2 libtimedate-perl liburi-perl mecab-ipadic mecab-ipadic-utf8 mecab-utils Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: mysql-client-8.0* mysql-common* mysql-server-8.0* mysql-server-core-8.0* 0 upgraded, 0 newly installed, 4 to remove and 14 not upgraded. 1 not fully installed or removed. After this operation, 138 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 46083 files and directories currently installed.) Removing mysql-server-8.0 (8.0.30-0ubuntu0.20.04.2) ... invoke-rc.d: could not determine current runlevel * Stopping MySQL database server mysqld [fail] invoke-rc.d: initscript mysql, action "stop" failed. dpkg: error processing package mysql-server-8.0 (--remove): installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1 dpkg: too many errors, stopping invoke-rc.d: could not determine current runlevel * Stopping MySQL database server mysqld [fail] invoke-rc.d: initscript mysql, action "stop" failed. invoke-rc.d: could not determine current runlevel Errors were encountered while processing: mysql-server-8.0 Processing was halted because there were too many errors. E: Sub-process /usr/bin/dpkg returned an error code (1)
これで消した。
stackoverflow.com
DBが起動できたと思ったらログインできなかったでござる
DBに起動でいないのは/var/log/mysql/の権限周りの問題だった。
こんなん出たわ。
$ mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
と思ったら、このDBパスワードかけてないからだった。パスワード入れないでいったら普通に行けたぜ。マジであぶねえ。
WSLでMySQLで色々やってたらMySQLを起動できなくなった
MySQLをdockerのコンテナからアクセスしようとして、色々やってMySQLを再起動したら起動しなくなった。
とりあえずlogを見ることを学んだ。
$ service mysql start * Starting MySQL database server mysqld su: Authentication failure $ tail /var/log/mysql/error.log ... [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30-0ubuntu0.20.04.2) starting as process 9840 mysqld: File './binlog.index' not found (OS errno 13 - Permission denied) ...
っていうのが見つかったので、ググったらMySQLにroot権限付けて入れるように設定変更しろと言われたので、↓のやり方でやってみた。
そうしたら別のエラーが出た。
$ sudo service mysql start * Starting MySQL database server mysqld $ tail /var/log/mysql/error.log [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
別のポート見に行ってんじゃねえのって言われた。
# 解決した
/var/lib/mysqlのパミッションの問題だった。
chown -R mysql.mysql /var/lib/mysql