$ mysql --version
mysql Ver 14.14 Distrib 5.6.22, for Linux (x86_64) using EditLine wrapper
$ mysqld --version
mysqld Ver 5.6.22 for Linux on x86_64 (MySQL Community Server (GPL))
7. MySQL サーバの起動・停止等
123456
$ sudo service mysql status # <= 状態確認
$ sudo service mysql stop # <= サーバ停止
$ sudo service mysql start # <= サーバ起動
$ sudo service mysql restart # <= サーバ再起動
$ sudo service mysql reload # <= サーバ再起動と同じ
$ sudo service mysql force-reload # <= サーバ再起動と同じ
$ mysql --help | grep -A1 "Default options"
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
9. MySQL サーバへのログイン
MySQL クライアントで MySQL サーバへ “root” でログインしてみる。(出力内容は、環境により異なる)
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.22-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
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> STATUS
--------------
mysql Ver 14.14 Distrib 5.6.22, for Linux (x86_64) using EditLine wrapper
Connection id: 1
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: less
Using outfile: ''
Using delimiter: ;
Server version: 5.6.22-log MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 1 min 2 sec
Threads: 1 Questions: 5 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.080
--------------
mysql>