the basics of MySQL
1. Use of help in MySQL server
Format: mysql> help commandeg: mysql> help create database Name: ' Create database ' description: syntax: create { database | schema} [if not exists] db_name [create_specification] ... create_specification: [default] character set [=] charset_name | [ Default] collate [=] collation_name create database creates a database with the given name. to use this statement, you need the CREATE privilege for the database. CREATE schema is a synonym for create database. url: http://dev.mysql.com/doc/refman/5.1/en/ create-database.html123456789101112131415123456789101112131415
2. Set a password for the user
First: Updating the user table update user set Password=password ("PASSWD") where user= "user" the second type: set password for [email protected] =pa ssWOrd ("password") Third: Use Mysqladmin command mysqladmin-u username-h host password "New password" 123456123456
3. mysql Mode of communication
Local communication: Communication based on localhost,127.0.0.1 or Lo addresses, all via Unix.socket remote communication: Communication via TCP socket 1212
4. Shortcut keys used in MySQL
Ctrl+w Delete the word before the cursor ctrl+u Delete all contents of the command line before the cursor ctrl+y paste use ctrl+w and ctrl+u deleted content CTRL + a move cursor at the beginning of the line ctrl+e move the cursor in line 1234512345
5. mysql variables
Static variables: Written in the configuration file, with the start of MySQL dynamic variable: You can modify the global variables at the time of MySQL Runtime: The current session changes the value of the variable, for subsequent connections in the session is valid query MySQL variable: mysql> show global| session variables; Change MySQL variable mysql> show global|session variables= ""; view MySQL default character set: Mysql> show global variables Like '%char% '; change MySQL default character set: Mysql> show Global character_set= "gb2321"; 123456789101112123456789101112
6.mysql Query Statements
select query statement execution Order start->from sentence->where statement->group by statement- >having sentence-->order by sentence-->select sentence-->limit sentence--The structure of the result SELECT statement: select [ALL | DISTINCT | DISTINCTROW ] [SQL_CACHE | SQL_NO_CACHE] SELECT_EXPR [, SELECT_EXPR&NBSP, ...]  FROM TABLE_REFERENCES    DISTINCT: Specifies that the same result set is displayed only once sql_ Cache: Cached in query cache sql_no_cache: Do not cache query structure connection query: left connection: select * from a left join b Right Connection: select * from a right join b Internal Connection: select * from a join b12345678910111213141234567891011121314
MySQL Simple architecture
650) this.width=650; "Src=" http://img.blog.csdn.net/20170719153612884?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqva2fpcnvpmtiz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
Query execution process: A.mysql after receiving a query request, now query the cache to find, if the search succeeds, execute F, if the lookup fails, execute b b. Send to the interpreter, interpret the SQL statement, then C c. Next, the SQL statement is optimized, then D. optimized sq The L statement is given to the storage engine for execution, followed by E-E. The results are cached in the query cache, followed by F. Results returned to the user
Basics of MySQL under Linux (i)