MySQL Client tool:
在用yum安装的maiadb-server的时候,在/etc/my.cnf.d下有一个名为client.cnf的文件,编辑此文件,在此文件的[client]下添加用户名和密码就可以不用输入口令登录 vim /etc/my.cnf.d/client.cnf [client] user=root # 登录数据库使用的用户名 password=mysql #登录数据库使用的密码
Most common SQL statements
1 Create Users and view (SQL statements);
create user [email protected]‘192.168.27.%‘ identified by ‘fang‘; #创建fang用户并且赋予密码为fang,整个27网段的用户都可以连接此数据库;,默认只有连接功能 select user,password,host from mysql.user; #创建的用户信息会存放在mysql库中的user表中,使用此sql可查看创建的用户;
2 remote host connection to database server (Linux command);
mysql -ufang -pfang -h192.168.27.105 #-u指定连接用户;-p指定连接密码;-h指定连接的主机;
3 Viewing user information (SQL statements) that are connected to the database server for work;
show processlist;
4 Viewing the user (SQL statement) currently connected to the database running;
select user();
5 Viewing the status of the current database (SQL statement)
status
6 view MySQL This command is the default connection database with parameters (Linux command);
mysql --print-defaults
There are also most of the SQL statements in this no longer an example, when the later encounter situation lookup syntax is OK;
MySQL client tools and common SQL statements