LoginSignup
3

More than 5 years have passed since last update.

BashOnUbuntuOnWindowsでMySQLを起動させる。

Posted at

BashOnUbuntuOnWindowsでMySQLを起動させる。

  • 利用環境:Bash on Ubuntu on windows Version 10.0.15063
  • mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64)

記事の前提・目的

  • 前提:BashOnUbuntuOnWindowsのバージョンを14393から15063に変更した。バージョン変更後、BashOnUbuntuOnWindowsを再インストールする必要があり、その結果、それまでのUbuntuの設定を再度行う必要があった。
    参考:http://www.buildinsider.net/enterprise/bashonwindows/creatorsupdate

  • 前提:これまで、BashOnUbuntuOnWindowsからMySQLを起動させる時には、常時起動しているMySQLを止めて、そのうえで、BashOnUbuntuOnWindowsからMySQLを起動させていた。

  • この記事の目的:今後BashOnUbuntuOnWindowsを再インストールした時に、参考にする。

BashOnUbuntuOnWindowsでMySQLをインストールする。

sudo apt-get install mysql-client-core-5.7

これは問題なし。

MySQLを起動させようとするとエラーになる。

  • BashOnUbuntuOnWindows でrails ssudo service mysql startを入力すると下記のエラーになる。 これを回避し、MySQLを起動させたい。
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

エラーメッセージで検索してみると参考になるサイトが出てくるのだけど、
今回は試してもうまくいかない...なんでだっけ...。

mysql-serverをインストールする必要があった。

sudo apt-get install mysql-server

これで、sudo service mysql startが効いた。

* Starting MySQL database server mysqld  
  No directory, logging in with HOME=/   
  [ OK ]

参考:http://qiita.com/hiroq/items/d6f611791ae2124f0fbe
   http://umatomakun.hatenablog.com/entry/2014/04/25/223240
   https://forums.ubuntulinux.jp/viewtopic.php?pid=91260

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3