Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in MYSQL database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is about what commands are commonly used in MYSQL databases. The secret of the text is that it is relevant to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on what commands are commonly used in MYSQL database.

Mysql database is a multi-user, multi-threaded relational database, which is an application with client / server structure. It is free for both individual and business users.

The Mysql database has the following advantages:

1. There is no limit to the number of users accessing the database at the same time.

two。 It can keep more than 50 million records.

3. It is the fastest database system among the existing database products on the market.

4. The setting of user rights is simple and effective.

Common commands for Mysql databases:

Start the Mysql database

C: > cd Mysql5.0in

C:Mysql5.0in > mysqld-install install Mysql service C:Mysql5.0in > net start mysql start Mysql service

The requested service has been started.

Connect mysql

The user needs to provide the user name and password of Mysql to connect to the server, and a hostname or IP to specify the location of the server if the server is not local.

```

C:Mysql5.0in > mysql-h localhost-u root-p

Enter password: *

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 6 to server version: 5.0.18-nt

Type help; or h for help. Type c to clear the buffer.

Mysql > use a simple query statement ```mysql > select version (), current_date; mysql > select version (); select now ()

Create or delete a database

Mysql > create database mydb

Commands for Mysql > drop database mydb; open database

Mysql > use mysql

Database changed

Commands to view the database

Mysql > show databases

View the detailed structure of the data table

```

Mysql > desc func; New Database

Mysql > create database school

Query OK, 1 row affected (0.00 sec)

New table ````mysql > create table user01 (- > id varchar (20) NOT NULL,-> userName varchar (10) NOT NULL,-> age int (11) default0,-> sex char (2) NOT NULL defaultm,-> PRIMARY KEY (id)-> TYPE=InnoDB; Query OK, 0 rows affected, 1 warning (0.02 sec) mysql > desc student

Insert and delete data from a table

```

Create table student (stuName varchar (20), age varchar (20), id varchar (20), set0 char (1)); insert

Mysql > insert into student (id,stuName) values (1meme tomcat)

Query OK, 1 row affected (0.00 sec)

Delete mysql > delete from student where id=1; Query OK, 1 row affected delete all data in the table mysql > truncate table student; Query OK, 1 row affected delete table mysql > create table temp (t varchar (1)), Query OK, 0 rows affected (0.00 sec) mysql > drop table temp Query OK, 0 rows affected (0.00 sec) create a new user and give permission mysql > grant all privileges on *. * to identified by 1234 with grant option Change the Mysql user password c:Mysql5.0in > mysqladmin-u root-p password 1234 Enter password: * backup the database and tables We use the mysqldump command to back up the database c:mysqlin > mysqldump-u root-p 3306 mysql > d:ackup.sql execute this statement to backup mydb to the backup.sql file on disk D to back up multiple database tables c:mysqlin > mysqldump-u root-p 3306 school user01 user > d: Ackup.sql this sentence means to back up the contents and definitions of the user01 table and user table in the school library to the D disk backup.sql file. Backup all databases c:myqlin > mysqldump-u root-p 3306-all-database > d:backup.sql spr webmaster information restore Mysql database c:mysqlinmysql-u root-p 3306 school restore one of the tables mysql > source drangooks.sql; ERROR: Unknown command. Query OK, 0 rows affected (0 sec) Query OK, 1 row affected (0 sec) exit Mysql connection mysql > quit (exit) close mysql service

C:mysqlin > net mysql

What are the common commands related to the above MYSQL database, is there anything you don't understand? Or if you want to know more about it, you can continue to follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report