1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLのログイン

Last updated at Posted at 2018-04-23

LinuxからMySQLにログイン

短縮する版


$ mysql -u username -ppassword db_name

短縮しない版


$ mysql --user=username --password=password db_name
  • 2018/05/10追記。コマンドを打ったらログインできなかった。でもシェルにして実行するとログイン出来た。
     
  • -pの後にスペースなどを入れずにパスワードを入れること。
  • db_nameは後で指定しても良い。
    ログインした後にuse db_nameでDB変更できる。
  • パスワードが見えちゃうから基本的にはおすすめしない。基本的には↓のログインを使う。

普段はこちらでログイン


$ mysql -u ユーザ名 -p
Enter password: password 
  • この方法だとパスワードは見えません。

参考
6.3.1 ユーザー名とパスワード
MySQLコマンドまとめ

1
0
0

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?