Create Database test_db; Create a database named test_db
Use test_db; Enter the TEST_DB database
Show tables; See how many tables are in the database
Drop database test_db; Deleting a database
drop table test01; Delete a table
Delete from test01; Clear Table Contents
Show variables like '%char% '; View the database character set
INSERT into test01 values ("001", "JF1"); Inserts data into the table.
SELECT * from test01; View test01 table data content.
CREATE TABLE test01 (ID varchar (), name varchar (20));
Grant all privileges the test_db.* to [e-mail protected] identified by ' 123456 ';
Grant all on test_db.* to [e-mail protected] identified by ' 123456 ';
Grant Select,insert,update,delete on * * to [e-mail protected] "%" identified by ' 123456 '; authorize MySQL database.
Flush privileges; Refresh Permissions
mysqldump–uroot–p123456 test_db >/tmp/test.db.sql; MySQL Backup or export
mysql–uroot–p123456 test_db </tmp/test.db.sql; MySQL Import
mysqladmin–uroot–p123456 password NewPassword; Modify the MySQL root password
Drop database test_db; Deleting a database
drop table test01; Delete a table
Delete from test01; Clear Table Contents
Show variables like '%char% '; View the database character set
INSERT into test01 values ("001", "WUGK1"); Inserts data into the table.
SELECT * from test01; View test01 table data content.
CREATE TABLE test01 (ID varchar (), name varchar (20));
ALTER TABLE Ip_can drop ID; Delete a field
ALTER TABLE Ip_can Add ID varchar (20); Add a field
ALTER TABLE Ip_can Add ID varchar (a) first;
In subsequent continuous updates
This article is from the "Fluffy Duck" blog, please be sure to keep this source http://woshitieren.blog.51cto.com/2466034/1681211
MySQL Common commands