Connect to MySQL server
MySQL client <--mysql protocol--> mysqld
Mysqld Receive connection request:
Local communication: The client is on the same host as the server side, and also communicates based on the 127.0.0.1 (localhost) address or the LO interface;
Linux OR Unix:unix Sock,/tmp/mysql.sock,/var/lib/mysql/mysql.sock
Windows:memory, Pipe
Remote communication: The client is on a different host than the server, or uses a non-loopback address to communicate on the same host
TCP sockets
Client tools: MySQL, Mysqladmin, mysqldump, Mysqlcheck
[Client]
Options for the pass:
-U,--user=
-H,--host=
-P,--password=
--protocol={tcp|socket|memory|pipe}
--port=
--socket= Example:/tmp/mysql.sock
MySQL Listener port: 3306/tcp
Management tools for non-client classes: Myisamchk, Myisampack
MySQL working mode:
Interactive mode
Mysql>
Script mode
MySQL </path/to/mysql_script.sql
MySQL Interactive mode:
Client commands
Mysql> Help
mysql> \?
\c
\g
\g
\q
\!
\s
\. /path/to/mysql_script.sql
Server-side command: Requires a command terminator, which defaults to a semicolon (;)
Mysql> Help Contents
Mysql> Help Keryword
MySQL command-line options:
--compress
--database=,-D
-H,--html: Document with output as HTML format
-X,--xml: output format is XML
# mysql--SATE-UPDATES-P login: Deny use of the update or delete command without a WHERE clause;
# mysql-h-P login, after which the display is the HTML document
MySQL command prompt:
mysql> Wait for input command
-
' >
">
' >
/*>
MySQL shortcut keys:
Ctrl + W: delete the words before the cursor
Ctrl + u: Delete all content before the cursor to the beginning of the command
Ctrl + y: Paste content deleted using Ctrl+w or Ctrl+u
Ctrl + A: Move the cursor to the beginning of the line
Ctrl + E: Move the cursor to the end of the line
################################################################################
Mysqldmin Tools:
mysqladmin [Options] command [ARG] [command [ARG]] ...
Command
Create Db_name
[Email protected] ~]# mysqladmin-uroot-p Create mydb1
[Email protected] ~]# mysql-uroot-p-e ' show databases; '
Drop db_name
Debug: Open debug Log and log in error log;
Status: Displays brief status information
[Email protected] ~]# mysqladmin-uroot-p status
[[email protected] ~]# mysqladmin-uroot-p status--sleep 2 interval 2 seconds
[[email protected] ~]# mysqladmin-uroot-p status--sleep 2--count 6 display times
Flush-hosts: empty host-related cache: DNS resolution cache, previously denied access to mysqld host list due to excessive number of connection errors
Flush-logs: Log scrolling, binary logs, and trunk logs
Refresh: Equivalent to simultaneous use of flush-logs and flush-hosts
Flush-privileges: Notice Reread Authorization Form
[Email protected] ~]# mysqladmin-uroot-p flush-privileges
[Email protected] ~]# mysqladmin-uroot-p Reload
Reload: function with Flush-privileges
Flush-status: Resetting the value of a state variable
Extended-status: Output mysqld state variables and their values, equivalent to performing "mysql> SHOW GLOBAL status"
[Email protected] ~]# mysqladmin-uroot-p flush-status
[Email protected] ~]# mysqladmin-uroot-p extended-status
Variables: Output mysqld for each server variable
Flush-tables: Closes the currently open table file handle
Flush-threads: Emptying the thread cache
Password: Modify the current user's password;
Ping:
Processlist: Displays the list of MySQL threads
[Email protected] ~]# mysqladmin-uroot-p processlist
Kill: Kills the specified thread ID and can kill multiple threads at a time, separated by commas, but not with extra spaces
Shutdown: Closing the mysqld process;
[Email protected] ~]# mysqladmin-uroot-p shutdown
Start-slave
Stop-slave: Start/close from server thread
[Email protected] ~]# mysqladmin-uroot-p Start-slave
[Email protected] ~]# mysqladmin-uroot-p Stop-slave
##########################################################################
GUI Client Tools:
Navicat for MySQL Strong
Toad for MySQL Strong
MySQL Front strong
SQLyog
MySQL Query Browser
Mysql Administrator
MySQL Workerbench
PhpMyAdmin Open Source
This article comes from "Life is endless, tossing and turning." "Blog, be sure to keep this provenance http://990487026.blog.51cto.com/10133282/1692910
MySQL mysqldmin command line tool GUI tool