Startup : net start MySQL
Close : net stop MySQL (can also be used with quit;)
Log on to Mysql:mysql-u root-p
-u : The name of the user to log in;
-P : tells the server that a password will be used to log in, ignoring this option if the user name password you want to log in is blank
Select the database you want to manipulate :
Name of the use database; (success will show databases changed
To create a new data table:
1 Create TableStudents2 (3IdintUnsigned not NULLAuto_incrementPrimary Key,4NameChar(8) not NULL,5SexChar(4) not NULL,6AgetinyintUnsigned not NULL,7TelChar( -)NULL default"-"8);
If the field is set to Auto-increment, you must set the primary key primary key,auto-increment is the number that is automatically incremented for the primary key.
If the code is too long, you may enter an error, you can use the Redirect method to enter the statement through any text editor and save it as a Xx.sql file, and execute the script through the file redirection at the command prompt. Open a command prompt and enter:
1 - - - < file name
To query the data in a table :
Select from [ query conditions ] ; Select from where condition; (can be added to the above conditions)
to insert data into a table:
Insert [into] [(column name 1, column name 2, column name 3, ...) ] VALUES (value 1, value 2, value 3, ...);
Change Database Password :
- -p password New password
after changing the password to use : Flush privileges;
List all databases : show databases;
list all tables in the database : show tables;
Some operations on the MySQL database