Wow, there's something in the background today! Does "MySQL" Count? Hehe, anyway feel write code write very happy, take today's summary of it! (Great God, do not like, do not spray)
1. Start MySQL first and link data for a few things! It's going to be, right?
MYSQL-UROOT-P//Connection data
net start MySQL//start MySQL
2, query the current server what data
show databases;
3. Create a database
Create DATABASE jddb-------databases name (JDDB)
4. Using the database
Use JDDB;
5. Query what tables are in the current database
Show tables;
6. Insert a table to the database
key,userName varchar (null,pwd varchar (null,null, sex varchar (null);
7. Inserting data into the table
Insert into User (Username,pwd,age,sex) VALUES (' Xiaoa ', ' abc123 ', 21, ' Male ');
Insert into User (Username,pwd,age,sex) VALUES (' xiaof ', ' CCCCC ', 48, ' female ');
Insert into User (Username,pwd,age,sex) VALUES (' Xiaog ', ' CCCCC ', 91, ' Male ');
8. Query data
select * from user;
Note: (This is likely to appear some small garbled event, then solve it!)
Solve garbled problem My.ini [mysqld] Write CHARACTER-SET-SERVER=GBK restart
Server
)
9, for the data just inserted in the table can be modified
Update user set age=20 where username= ' Xiaoa ';
10. Enquiry
Select Username,age,sex from user;
SELECT * from user where sex= ' man '
11. Delete
Delete from user where age>90 (this will remove the third data)
12. Modify Table name
ALTER TABLE user Rename to Huiyuan
13. Delete a table
--drop table user;
--drop database jddb;
14, a little follow-up work, you can back up the database it!
Database backup Data Export
Mysqldump-uroot-p >g:\jddb.sql
Database Restore Data Import
SOURCE G:\jddb.sql
Mysql-uroot-p Jddb<g:\jddb.sql
15. Close the database
NET stopt mysql//start MySQL
MySQL Connection database