There is a graphical management of MySQL tool called phpMyAdmin, how to manage and operate MySQL under the command line.
First go to MySQL
Mysql-uroot-pwangshaojun
See which libraries are available
> show databases;
Switch to a library
> Use Discuz
See which library is currently in
Select Database ();
View the currently logged on user
Select User ();
View version
Select version ();
Switch to library Yes
> Use discuz;
View Table
> Show tables;
See what fields are in the table
Descdesc Pre_ucenter_vars;
View creation statements for a table
Show CREATE TABLE pre_ucenter_vars\g;
////////////////////////////////////////////////////////////////////////////////////////////////////////
Create library, library name: Wangshaojun
> CREATE Database Wangshaojun;
Switch to the Wanghsaojun library.
Use Wangshaojun;
Create a table
int (4char(+)) Engine=myisam DEFAULT CHARSET=GBK;
Create a table with the table name: TB1. There are two fields, one called ' ID ' format int length up to 4 bits one called ' name ' format is char maximum of 40. Specifies the engine. Character Set GBK.
Show all tables under the current library
> Show tables;
Analysis Table TB1
> desc tb1;
Inserting data into a table
> INSERT into TB1 values (1,'wangshaojun');
Id,name are 1 and Wangshaojun, respectively.
Select a bit
Select from TB1;
Continue to add
> INSERT into TB1 values (2,'Denny');
You can also add a single character
> INSERT into TB1 (' id ') VALUES (2);
> INSERT into TB1 (' id ') VALUES (4);
You can also add the name
> INSERT into TB1 (' name ') VALUES ('+');
can also be specified in reverse order
> INSERT into TB1 (' name ', ' ID ') VALUES ('6');
Updating data in tables
set id=5where'in ';
Update the ID of the NAME=55 data to 5
Delete a row
from where name='in ';
Clears a table, but does not delete
> TRUNCATE TABLE wangshaojun.tb1;
Specify the library name and table name
Delete a table
> drop table tb1;
Delete a library
> DROP database Wangshaojun;
LAMP 3.3 MySQL Common operation-1