1. The basic operation of Mysql
1. Start the server
① Run as an administrator (cmd)
Enter net start mysql Start the server
Enter net stop mysql Shut down the server
② Right-click My Computer Management to find the service and application management Click the service to find Mysql Right-click to open
2. Log in to Mysql
to manage Run as a member (cmd)
enter
"cd C: \ Program Files \ MySQL \ MySQL Server 5.5 \ bin"
"cmd> mysql –u root –p” // u is the username p is the password
and then enter the password to log in
3. Learn to use the basic operations of Navicat MySQL administration tool
① New Connection MySQL
open Navicat MySQL enter click on the link in the connection name and enter the password for the user name defaults to root
Click Test to test whether the connection is successful
then determine
② view the actions
MySQl choose to click on the new "open "Connect", you can see the four databases generated by default, taking the database "mysql" as an example, click to open.
③New query
Open the database "mysql", click "Query" at the top of the Navicat main interface, select "New query", and enter the following statement in the query editor that pops up:
USE mysql; // Use mysql database
SELECT * FROM help_category; / / View the table "help_category" in the database "mysql" ④Close
and delete the connection
Right-click the connection "MySQL" and select "Close Connection". Select "Delete Connection" for the same operation.
4. Learn user management under Navicat, including creating , editing, and deleting.
1. Create a new user.
Click MySQL and then click User to select a new user.
Fill in the user name "NewUser", host "localhost", password " 1234 "(the password can be remembered if you set it yourself) and confirm again, check all the" Server Permissions "
② Use a new user to establish
a connection is basically the same as the connection established above. Note that the user is NewUser (no longer the default root) The password is the one you set
③Delete user
Select the modified user, click "Delete user", select "OK"
5. MySQL client access database information
① Log in to the client
Find the client under the Mysql folder in the start menu
② Use the show statement to view the existing database in the system (including the user-created)
Show databases;
③ Use the mysql database to
enter Statement Use mysql
④Use the show tables statement to view the tables in the current database
show tables;
⑤Use a select statement to view the contents of the table user information stored in the mysql database
Select user from user;
2. Creation of the database
1. Create a database named db1
① Log in to the server
② Enter the create statement
Enter "create database db1"
③ See if the creation is successful
Enter show databases;
you can see that it has been successfully created
2. Create a db2 using the utf-8 character set Database
Enter "create database db2 character set utf8;"
3. Create a utf-8 character set
Create a mydb3 database using utf-8 character set and collation rules (utf8_general_ci) (collation rules, which can be understood as sorting rules)
Input: "create database db3 character set utf8 collate utf8_general_ci;"
4. The
specific steps of the graphical user interface Navicate operation are as follows: New connection "MySQL" -click to select and right click- "New database" -enter the database name "mydb", character set "Utf8-UTF-8 Unicode", sorting rule "utf8_general_ci"-"OK". As shown in the figure:
5. Create a database using Transact-SQL language,
click "New Query", enter the following code in the query editor, click "Run", after completion, select the connection "MySQL" in the list on the left, click "Refresh" Press the button to see "testdb" in the list. As shown:
CREATE DATABASE testdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
6. The method of querying the table using Transact-SQL language
Note that first enter USE mysql;
①SHOW COLUMNS FROM table name;
②DESCRIBE table name;
③DESC table name;
④SELECT * FROM table name;
Below is a little white. If there is an inappropriate place, please correct me.