日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

十九、MySQL常用命令总结

發布時間:2024/7/5 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 十九、MySQL常用命令总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數據結構核心原理與算法應用


C:\Windows\system32> net stop mysql0815

MySQL0815 服務正在停止. MySQL0815 服務已成功停止。

C:\Windows\system32>net start mysql0815

MySQL0815 服務正在啟動 . MySQL0815 服務已經啟動成功。

C:\Windows\system32>mysql -h localhost -P 3306 -u root -p
Enter password: ****

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.15 MySQL Community Server (GPL)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

Bye

C:\Windows\system32>mysql -h localhost -P 3306 -u root -proot

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.15 MySQL Community Server (GPL)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

Bye

C:\Windows\system32>mysql -u root -proot

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.5.15 MySQL Community Server (GPL)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)

mysql> use test;

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql> show tables from mysql;

+---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | host | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 24 rows in set (0.00 sec)

mysql> select database();

+------------+ | database() | +------------+ | test | +------------+ 1 row in set (0.00 sec)

mysql> create table stuinfo(
-> id int,
-> name varchar(20));

Query OK, 0 rows affected (0.01 sec)

mysql> show tables;

+----------------+ | Tables_in_test | +----------------+ | stuinfo | +----------------+ 1 row in set (0.00 sec)

mysql> desc stuinfo;

+-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | name | varchar(20) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec)

mysql> select * from stuinfo;

Empty set (0.00 sec)

mysql> insert into stuinfo (id,name) values(1,‘john’);

Query OK, 1 row affected (0.00 sec)

mysql> insert into stuinfo (id,name) values(2,‘rose’);

Query OK, 1 row affected (0.00 sec)

mysql> select * from stuinfo;

+------+------+ | id | name | +------+------+ | 1 | john | | 2 | rose | +------+------+ 2 rows in set (0.00 sec)

mysql> update stuinfo set name=‘lilei’ where id=1;

Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from stuinfo;

+------+-------+ | id | name | +------+-------+ | 1 | lilei | | 2 | rose | +------+-------+ 2 rows in set (0.00 sec)

mysql> delete from stuinfo where id=1;

Query OK, 1 row affected (0.00 sec)

mysql> select * from stuinfo;

+------+------+ | id | name | +------+------+ | 2 | rose | +------+------+ 1 row in set (0.00 sec)

mysql> select version();

+-----------+ | version() | +-----------+ | 5.5.15 | +-----------+ 1 row in set (0.00 sec)

mysql> exit

Bye

C:\Windows\system32>mysql --version

mysql Ver 14.14 Distrib 5.5.15, for Win32 (x86)

C:\Windows\system32>mysql -V

mysql Ver 14.14 Distrib 5.5.15, for Win32 (x86)

C:\Windows\system32>mysql -uroot -p
Enter password: ****

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.5.15 MySQL Community Server (GPL)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show DATABASES;

+--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)

mysql> SHOW DATABASES\g

+--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)

mysql> use test;

Database changed

mysql> select * from stuinfo;

+------+------+ | id | name | +------+------+ | 2 | rose | +------+------+ 1 row in set (0.00 sec)

mysql> select *
-> from stuinfo;

+------+------+ | id | name | +------+------+ | 2 | rose | +------+------+ 1 row in set (0.00 sec)

mysql> SELECT
-> *
-> FROM
-> stuinfo;

+------+------+ | id | name | +------+------+ | 2 | rose | +------+------+ 1 row in set (0.00 sec)

mysql> select * from stuinfo;

+------+------+ | id | name | +------+------+ | 2 | rose | +------+------+ 1 row in set (0.00 sec)

總結

以上是生活随笔為你收集整理的十九、MySQL常用命令总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。