Use operations
tee [directory file] can record mysql operations and results
set names gbk explicitly tells the mysql server that the client's encoding is gbk (to prevent garbled characters)
desc [table name] table Structural details
Login command mysql -u[username] -p[userpasswd]
Multiple tables--->Place them in one library--->Multiple libraries form a database server
Operation process
When entering the database, you first face multiple libraries, select the required library among multiple libraries, and then select the required table in the library
Specific commands
1. Check which libraries are in the database show databases;
2. Select the required library use [library name];
3. Check which tables are in the selected library show tables;
Create a library create database [unimasvg1] charset utf8;
Delete a library drop database [unimasvg1]
Modify a library (mysql library cannot change the library name)
Create a simple table
create table staff( snum int, sname varchar(10) )engine myisam charset utf8;
Rename table
rename table [oldname] to [newname]
Add content to the table
insert into [表名] values (1,'name_1'), (2,'name_2'), (3,'name_3');
Display table content
select * from [表名]
Delete a table
drop table staff
Clear table contents
truncate [表名] --- 原理是 删除表,再重建一个同样名字的表 delete from [表名] where [条件] --- (可选删除)
The speed of deleting data, generally speaking: drop> truncate > delete
The above is the content of the basic operations of mysql. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!