[root@gary-tao webapps]# ps aux |grep mysql
root 3237 0.0 0.1 113268 1364 ? S 1月12 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/gary-tao.pid
mysql 3373 0.0 45.3 1301004 453000 ? Sl 1月12 3:17 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/gary-tao.err --pid-file=/data/mysql/gary-tao.pid --socket=/tmp/mysql.sock
root 23828 0.0 0.0 112680 976 pts/1 R+ 11:23 0:00 grep --color=auto mysql
[root@gary-tao webapps]# mysql -uroot -pszyino-123
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.6.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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> create database zrlog; //创建一个数据库
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zrlog.* to 'zrlog'@127.0.0.1 identified by 'szyino-123'; //创建一个用户
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[root@gary-tao webapps]# mysql -uzrlog -h127.0.0.1 -pszyino-123
//检测创建用户是否可以连接
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.6.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, 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>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| zrlog |
+--------------------+
3 rows in set (0.00 sec)