十九、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常用命令总结相关推荐
- MYSQL常用命令(转载)
1.导出整个数据库 mysqldump -u 用户名 -p --default-character-set=latin1 数据库名 > 导出的文件名(数据库默认编码是latin1) mysqld ...
- Mysql常用命令行大全
Mysql常用命令行大全 第一招.mysql服务的启动和停止 net stop mysql net start mysql 第二招.登陆mysql 语法如下: mysql -u用户名 -p用户密码 键 ...
- MYSQL常用命令大全(收集的超全)!
文章目录 一.MYSQL常用命令 1: 1.导出整个数据库 2.导出一个表 3.导出一个数据库结构 4.导入数据库 启动与退出 二.库操作 1.创建数据库 2.显示所有的数据库 3.删除数据库 4.连 ...
- MYSQL常用命令大全(导入导出、创建、单多表查询(超详细)、授权)
MYSQL常用命令 一.导入导出 1.导出整个数据库 mysqldump -u 用户名 -p --default-character-set=latin1 数据库名 > 导出的文件名(数据库默认 ...
- 征途linux mysql_MySql征途之mysql常用命令
mysql征程之mysql常用命令 一.连接MySql 语法: mysql -h 主机地址 -u 用户名 -p 用户密码 例1:连接到本机上的MYSQL.键入命令mysql -u root -p(本地 ...
- mysql tree 修改_13.1 设置更改root密码 13.2 连接mysql 13.3 mysql常用命令
更改root密码 ps aux |grep mysql //先查看一下mysql是否启动了 /etc/init.d/mysqld start //启动mysql ps aux |grep ...
- 设置更改root密码(远程,本地)、连接mysql、mysql常用命令
设置更改root密码 1.将mysql加入环境变量中 [root@centos7 ~]# grep mysql /etc/profile export PATH=/usr/local/mysql/bi ...
- MySql常用命令集Mysql常用命令showdatabases;显示数据库createdatab
MySql 常用命令集 Mysql常用命令 show databases; 显示数据库 create database name; 创建数据库 use databasename; 选择数据库 drop ...
- 【CentOS 7MySQL常用操作3】,MySQL常用命令#180113
2019独角兽企业重金招聘Python工程师标准>>> hellopasswd MySQL常用命令 查询库show databases; 切换库use mysql; 查看库里的表sh ...
- 设置更改root密码 连接mysql mysql常用命令
一.设置更改root密码 #/etc/init.d/mysqld start #ps aux |grep mysql #mysql -uroot //提示-bash: mysql : 未找到命令 #l ...
最新文章
- 【实现手机端上滑滚动加载列表】判断页面是否滚动到底部或者指定元素位置
- ArcGIS Server 10.1动态图层 以及Windows Phone/Silverlight客户端实现
- easyui datagrid
- 用matlab绘制升余弦函数
- 为PHP5.4开启Zend OPCode缓存
- docker 限制容器日志大小
- Spring在web中的使用
- linux卡死在选择内核界面,求助:am3352 linux内核启动时卡在 Starting kernel ...
- 十项全能的java大神
- fullPage.js给网站加上全屏幻灯片的展示效果
- 用Supermemo背单词达到8000词条
- php mysql sum_thinkphp mysql语句 sum
- 收藏的一些github开源项目,在这里记录一下
- android stadio 编译报错:download fastutil-7.2.0.jar
- BlockUI对话框
- YOLACT论文阅读及解析
- 欧阳娜娜从阿里跳槽网易:阿里P8堪称教科书级别的面试现场!最后一个问题亮了...
- 电子邮件的地址格式是怎样的?请说明各部分的意思。
- mysql 按月和年累加_2020年5月播出的电视剧汇总,按时间先后顺序排列
- Caused by:java.io.IOException:Could not find resourse UserMapper.xml
热门文章
- flask-SQLAlchemy 使用 session.commit() 处理异常回滚
- java 数据结构_Java版-数据结构-队列(数组队列)
- opencv python教程简书_OpenCV-Python系列二:常用的图像属性
- 网络:常见的端口号及分类
- android关机分区卸载,Android关机重启流程(二)
- 与fastboot相关的知识
- mysql重新用户设置密码_mysql用户密码如何重新设置?
- Introducing the ClearGLASS App on ClearOS
- php的memcache安装,在window10下面
- 2016年度 JavaScript 展望(下)