Mysql learning practices --- Basic settings, mysql learning practices ---
This article is MOOC network MySql study notes, address: http://www.imooc.com/learn/122
1. Configure the default Character Set utf8 in my. ini
A. Client: [mysql]Default-character-set = utf8
B. server: [mysqld] character-set-server = utf8
Ii. Start and Stop the mysql Service
A. in windows, choose Computer Management> services> mysql, right-click to start or stop
B. Run the command to open cmd and start the service using net start mysql. Use net stop mysql to stop the service.
Iii. log on and exit
A. logon Parameters
B. exit mode: exit; or quit; or \ q;
4. Modify the mysql prompt (\ D -- complete date, \ d -- current database, \ h -- server name, \ u -- current user. Eg: \ u @ \ h \ d)
A. When logging on to the service, for example, mysql-uroot-p -- prompt
B. Use the prompt after logon;
V. Common mysql commands
A. view the current VERSION: select version ();
B. view the current date and time: SELECT NOW (); view the current date: SELECT CURDATE (); view the current time: SELECT CURTIME ();
C. view the current logon USER: select user ();
D. view the warning information: show warnings;
E. view the DATABASE creation Information: show create database dbname;
F. view the TABLE creation Information: show create table tablename \ G; (\ G indicates formatting output result information, SELECT * FROM tablename \ G; indicates printing TABLE data by column)
Vi. mysql statement specifications
A. All keywords and function names are capitalized.
B. The database name, table name, and field name are all in lowercase.
C. Each SQL data must end;
7. Create a database (mandatory for braces and optional for brackets)
8. Modify the database Character Set
9. delete a database