1MySQL directory structure bin: stores executable files data: stores data files docs: documentation include: stores included header files lib: Repository file share: error messages and character set files note: here is utf8 instead of the utf-82 to modify the encoding method generally need to modify 1. mySQL directory structure
Bin: stores executable files.
Data: stores data files.
Docs: Documentation
Include: stores included header files.
Lib: Repository file
Share: error messages and character set Files
Note: utf8 is used instead of UTF-8.
2. modify the encoding method
In general, you need to modify the my. ini configuration file in the MySQL installation directory:
[Mysql]
Default-character-set = utf8
[Mysqld]
Character-set-server = utf8
3. start/close the MySQL service
(1) you can use windows ---> services ---> MySQL services ---> start/stop
(2) use the command line net start mysql to start the service, and use net stop mysql to stop the service.
4. logon and exit
Some MySQL commands:
Add the bin path to the system environment variable and open the command prompt line:
Login: mysql-uroot-p-P3306-h126.0.0.1, and then enter the password to log on.
Exit: quit, exit, or \ q
5. modify the MySQL prompt and use: mysql-uroot-proot -- prompt
After logging on, you can use the: prompt
Several special prompts that can be set:
\ D: complete date
\ D: current database
\ H: Server Name
\ U: current user
6. MySQL common commands and syntax specifications
Select version (); displays the current server VERSION
Select now (); displays the current date and time
Select user (); displays the current USER
(1). all keywords and function names are capitalized.
(2). The database name, table name, and field name are all in lowercase.
(3) the SQL statement must end with a semicolon
7. operate on the DATABASE to CREATE a DATABASE: CREATE {DATABASE | SCHEMA} [if not exists] db_name [DEFAULT] character set [=] charset_name;
View the list of data tables on the current server: SHOW {DATABASES | SCHEMA} [LIKE 'pattern' | WHERE expr];
View warning information: show warnings;
View creation information: show create database db; (view statements for creating a DATABASE)
Use gbk encoding to CREATE a DATABASE: create database if not exists db2 character set gbk;
Modify DATABASE: ALTER {DATABASE | SCHEMA} [db_name] [DEFAULT] character set [=] charset_name;
Delete DATABASE: DROP {DATABASE | SCHEMA} [if exists] db_name;