Getting started with MySQL database

Source: Internet
Author: User

MySQL has been mentioned in many places, and children's shoes that have not previously been contacted by MySQL database can walk into MySQL's world with me.

http://hovertree.com/menu/mysql/

Installation I will not say more, are the installation of fools.

After installation, you can see that there is a service in the service.

Of course to start it. Set to Automatic or manual depending on your needs.

See the path to this service "C:\Program files\mysql\mysql server 5.5\bin\mysqld"--defaults-file= "C:\Program files\mysql\mysql server 5.5\my.ini "MySQL

Find the commands in this folder to see some MySQL. You can click on the MySQL command to launch, of course, you can also enter CMD in the run and mysql-uroot-p to start

I do not know that after the installation environment variable is not so in the cmd directly knocking this is no effect. You must first configure the path, which is the environment variable, and add this MySQL command path C:\Program files\mysql\mysql Server 5.5\bin the following details

Right click on "My Computer", select "Properties", then "Advanced", then click on "Environment variables", in the "System Variables" column, double-click "Path" in the "variable value" the last side to add ";" and C:\Program Files\mysql\mysql Server 5.5\bin

or operate directly in the following

Run the cmd input d:\>set path=%path%; C:\Program Files\mysql\mysql Server 5.5\bin

As follows

As for the environment variable configuration has been said almost. Really do not know on the message or check information ....

Http://hovertree.com/h/bjaf/008kix5q.htm

Some simple things about MySQL are the following

Mysql-uroot-p log in to MySQL

Start the service
net start Wampmysqld
Close Service

net stop Wampmysqld

or log in to MySQL like this
MySQL--urser root--password

Quit MySQL
Quit
Exit

Log in to MySQL
D:\>mysql--host localhost--user root--password


Shorthand
D:\>mysql-hlocalhost-uroot-p


Native Login
D:\>mysql-uroot-p


2. Create MySQL accounts and tables

Mysql> Show databases
;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.00 sec)

Or simply enter the command after entering \g as follows
Mysql> Show Databases \g
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.00 sec)


The back and the \c don't execute orders.
Mysql> desc Test \c


MySQL New user

Mysql> Grant all on test.* to "Mrzhou" @ "localhost" identified by "Mrzhou"
;
Query OK, 0 rows affected (0.01 sec)

Mysql> quit
Bye

D:\>mysql--user Mrzhou--password
Enter Password: ******

Or log in like this
D:\>mysql-umrzhou-p
Enter Password: ******

Create a database
Mysql> Create DataTable Mrzhou;

Create a table
Mysql> CREATE TABLE student (ID int) PRIMARY key Auto_increment,name Varch
0), age tinyint (2));
Query OK, 0 rows affected (0.13 sec)


mysql> desc Student;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| ID | Int (10) | NO | PRI | NULL | auto_increment |
| name | varchar (30) |     YES | |                NULL | |
| Age | tinyint (2) |     YES | |                NULL | |
+-------+-------------+------+-----+---------+----------------+
3 rows in Set (0.01 sec)

Inserting data into a table

mysql> INSERT into student (Name,age) VALUES ("Zhang San", 33);
Query OK, 1 row affected (0.05 sec)

Mysql> select * from student;
+----+------+------+
| ID | name | Age |
+----+------+------+
| 1 |   Zhang San | 33 |
+----+------+------+
1 row in Set (0.00 sec)

Export Library
D:\>mysqldump-uroot-p Mrzhou>d:mrzhou.sql
Enter Password:


Delete a table
mysql> drop table student;
Query OK, 0 rows affected (0.03 sec)

Import Library
D:\>mysql-uroot-p Mrzhou < D:/mrzhou.sql
Enter Password:

or with

Mysql> Source D:/mrzhou.sql
Query OK, 0 rows Affected (0.00 sec)

Query OK, 0 rows Affected (0.00 sec)

Query OK, 0 rows Affected (0.00 sec)

Query OK, 0 rows Affected (0.00 sec)

Query OK, 0 rows Affected (0.00 sec)

Transferred from: http://hovertree.com/h/bjaf/mysqlrumen.htm

Recommendation: http://www.cnblogs.com/roucheng/p/mysqlfenqu.html

Getting started with MySQL database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.