10. Data update of the table
(1) Change one field at a time, pay attention to grammar again. Text needs to be enclosed in quotes but not in numbers.
Mysql>update table01 Set field03= ' new info ' swheresfield01=1;
Query OK, 1 row Affected (0.00 sec)
(2) Change multiple fields at once, remembering to separate each updated field with a comma.
Mysql>update table01 set field04=19991022, field05=062218swheresfield01=1;
Query OK, 1 row Affected (0.00 sec)
(3) Update multiple data at once
Mysql>update TABLE01 Set field05=152901swheresfield04>19990101;
Query OK, 3 Rows Affected (0.00 sec)
11. Delete Data
Mysql>delete from Table01swheresfield01=3;
Query OK, 1 row Affected (0.00 sec)
12. Import Database Tables
(1) Create. sql file
(2) First create a library such as Auction.c:mysqlin>mysqladmin-u root-p creat auction, prompts for a password, and then successfully created.
(3) Import Auction.sql file
C:mysqlin>mysql-u Root-p Auction < Auction.sql.
By doing this, you can create a database auction and one of the table auction.
Authorization of the 13.mysql database
Mysql>grant Select,insert,delete,create,drop
On *.* (or test.*/user.*/.)
To User name @localhost
Identified by ' password ';
Such as: Create a new user account so that you can access the database, you need to do the following:
Mysql> Grant Usage
-> on test.*
-> to Testuser@localhost;
Query OK, 0 rows affected (0.15 sec)
Since then, a new user is created: testuser, this user can only connect to the database from localhost and connect to the test database. Next, we must specify what testuser this user can do:
mysql> GRANT Select, INSERT, Delete,update
-> on test.*
-> to Testuser@localhost;
Query OK, 0 rows Affected (0.00 sec)
This action enables TestUser to perform Select,insert and delete and update query operations in each table in the test database. Now we end the operation and exit the MySQL client program:
Mysql> exit
Bye
14. Authorize the MySQL user password
The default username for the MySQL database is "root" (similar to the SA for MS SQL Server) and the password defaults to null. At the DOS prompt (note, not the MySQL prompt), enter
c:mysqlin> "mysqladmin-u root-p password NewPassword
Return will prompt you to enter the original password, because the original password is empty, direct return, root user's password will be changed to "NewPassword".