MySQL 服务常用操作命令
1、MySQL 服务设置
在使用
mysql.server命令之前需要将路径/usr/local/mysql/support-files添加到系统环境变量中。export PATH=$PATH:/usr/local/mysql/support-files
在使用
mysql命令之前需要将路径/usr/local/mysql/bin添加到系统环境变量中。export PATH=$PATH:/usr/local/mysql/bin
具体设置请参照《添加系统环境变量》章节。
2、MySQL 服务常用操作
2.1 MySQL 服务控制命令
MySQL 服务控制命令
# 启动 MySQL 服务
$ sudo mysql.server start Starting MySQL
.. SUCCESS!# 停止 MySQL 服务
$ sudo mysql.server stop Shutting down MySQL
.. SUCCESS!
# 重启 MySQL 服务
$ sudo mysql.server restart Shutting down MySQL
.. SUCCESS!
Starting MySQL
.. SUCCESS!
# 重新加载
$ sudo mysql.server reload SUCCESS! Reloading service MySQL
# 强制重新加载
$ sudo mysql.server force-reload SUCCESS! Reloading service MySQL
# 查看 MySQL 服务状态
$ mysql.server status ERROR! Multiple MySQL running but PID file could not be found (61998 62083 )
2.2 MySQL 服务连接命令
MySQL 服务连接命令
# 登录 MySQL 服务
# mysql -u 用户名 -p 密码
$ mysql -u root -p Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 930
Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2018, 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>
# 登出 MySQL 服务
> exit Bye
3、MySQL 服务帮助操作
3.1 按照层次看帮助
如果不知道帮助能够提供什么,那么就可以直接用 “? contents” 命令来显示所有可供查询的分类,对于分类可以使用 “? 分类名称” 的方式针对用户感兴趣的内容做进一步的查看,通过这种 “? 类型别名” 的方式,就可以一层层的往下查找用户所关心的主题内容。
> ? contents
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
Account Management
Administration
Components
Compound Statements
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Help Metadata
Language Structure
Plugins
Storage Engines
Table Maintenance
Transactions
User-Defined Functions
Utility
3.2 快速查阅帮助
在实际应用中,如果需要快速查阅某项语法时,可以使用 “? 关键字” 方式进行快速查询。
> ? insert
Name: 'INSERT'
Description:
Syntax:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[(col_name [, col_name] ...)]
{VALUES | VALUE} (value_list) [, (value_list)] ...
[ON DUPLICATE KEY UPDATE assignment_list] INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
SET assignment_list
[ON DUPLICATE KEY UPDATE assignment_list] INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[(col_name [, col_name] ...)]
SELECT ...
[ON DUPLICATE KEY UPDATE assignment_list] value:
{expr | DEFAULT} value_list:
value [, value] ... assignment:
col_name = value assignment_list:
assignment [, assignment] ... INSERT inserts new rows into an existing table. The INSERT ... VALUES
and INSERT ... SET forms of the statement insert rows based on
explicitly specified values. The INSERT ... SELECT form inserts rows
selected from another table or tables. INSERT with an ON DUPLICATE KEY
UPDATE clause enables existing rows to be updated if a row to be
inserted would cause a duplicate value in a UNIQUE index or PRIMARY
KEY. For additional information about INSERT ... SELECT and INSERT ... ON
DUPLICATE KEY UPDATE, see [HELP INSERT SELECT], and
http://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html. In MySQL 8.0, the DELAYED keyword is accepted but ignored by the
server. For the reasons for this, see [HELP INSERT DELAYED], Inserting into a table requires the INSERT privilege for the table. If
the ON DUPLICATE KEY UPDATE clause is used and a duplicate key causes
an UPDATE to be performed instead, the statement requires the UPDATE
privilege for the columns to be updated. For columns that are read but
not modified you need only the SELECT privilege (such as for a column
referenced only on the right hand side of an col_name=expr assignment
in an ON DUPLICATE KEY UPDATE clause). When inserting into a partitioned table, you can control which
partitions and subpartitions accept new rows. The PARTITION option
takes a list of the comma-separated names of one or more partitions or
subpartitions (or both) of the table. If any of the rows to be inserted
by a given INSERT statement do not match one of the partitions listed,
the INSERT statement fails with the error Found a row not matching the
given partition set. For more information and examples, see
http://dev.mysql.com/doc/refman/8.0/en/partitioning-selection.html. URL: http://dev.mysql.com/doc/refman/8.0/en/insert.html
3.3 常用的网络资源
MySQL 官网 可以下载到各个版本的 MySQL 以及相关客户端开发工具等。
MySQL 在线手册 提供了目前最权威的 MySQL 数据库及工具的在线手册。
MySQL bug 列表 可以查看到 MySQL 已经发布的 bug 列表,或者向 MySQL 提交 bug 报告。
MySQL 的最新消息 通常会发布各种关于 MySQL 的最新消息。
MySQL 服务常用操作命令的更多相关文章
- Linux系统MySQL的常用操作命令
安装好MySQL服务后添加环境变量: #vi /etc/profile export MYSQL_HOME=/usr/local/mysql export PATH=$PATH:$MYSQL_HOME ...
- MySQL的常用操作命令详解
系统管理">系统管理 mysql服务">启动MySQL服务 通过windows服务管理器启动MySQL服务 ? 1 开始-->运行-->输入services ...
- MYSQL数据库常用操作命令
1.连接MYSQL: mysql -h 主机地址 -u 用户名 -p 2.修改密码: 安装后第一次登录使用: mysqladmin (因为没有初始密码) 修改原密码: mysqladmin -u ro ...
- mysql服务常用命令
一.查出当前mysql正在执行的sql命令mysql> show full processlist; 然后找出要终止的语句的idmysql> kill id号 未登录的情况下>mys ...
- 【Linux命令】mysql数据库常用操作命令
#数据库操作: #建立数据库 create database data_name #删除数据库 drop database data_name #查看: show databases; #表操作: # ...
- mysql 中启动服务的命令 、登录命令、退出命令 mysql 的常用命令
1.cmd 以管理员执行 下面命令 启动服务 :net start mysql57 关闭 服务:net stop mysql57 查看mysql 的版本信息 : mysql -V 指定主机地址登录: ...
- mysql 常用操作命令
mysql官网指南:http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html 1.导出整个数据库mysqldump -u 用户名 -p --defa ...
- ubuntu下mysql的常用命令,MySQL数据库的基本操作命令
一.mysql服务操作 0.查看数据库版本 sql-> status; 1.net start mysql //启动mysql服务 2.net stop mysql //停止mysql服务 3 ...
- 两种常用的启动和关闭MySQL服务
本博文的主要内容有 .通过图形界面来启动和关闭MySQL服务 .通过DOS窗口来启动和关闭MySQL服务 1.通过图形界面来启动和关闭MySQL服务 2.通过DOS窗口来启动和关闭MySQL服务 感谢 ...
随机推荐
- TF:TF下CNN实现mnist数据集预测 96%采用placeholder用法+2层C及其max_pool法+隐藏层dropout法+输出层softmax法+目标函数cross_entropy法+AdamOptimizer算法
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # number 1 to 10 ...
- HDU 1385 Minimum Transport Cost (输出字典序最小路径)【最短路】
<题目链接> 题目大意:给你一张图,有n个点,每个点都有需要缴的税,两个直接相连点之间的道路也有需要花费的费用.现在进行多次询问,给定起点和终点,输出给定起点和终点之间最少花费是多少,并且 ...
- POJ 3189 Steady Cow Assignment 【二分】+【多重匹配】
<题目链接> 题目大意: 有n头牛,m个牛棚,每个牛棚都有一定的容量(就是最多能装多少只牛),然后每只牛对每个牛棚的喜好度不同(就是所有牛圈在每个牛心中都有一个排名),然后要求所有的牛都进 ...
- Windows 自动启动 bat
创建文件,然后把这个文件放到window开机自动执行的目录中,之后的每次开机都会重新启动这个脚本 cd /d %~dp0 %1 start "" mshta vbscript:cr ...
- checkbox、radio设置自定义样式
老生常谈,做一个简单的记录.浏览器自带的checkbox和radio样式可能不符合项目要求,通常要做一些自定义样式设置,目前基本的解决思路都是将input[type=checkbox/radio]隐藏 ...
- CSS选择器、样式、盒模型
一.CSS基础选择器 # 1.*(通配选择器):html,body以及body下用于显示的标签 #html和body颜色会被改变,但是div标签不会发生改变,由于不同的选择器具有优先级 # 语法:* ...
- DRF的视图
DRF的视图 APIView 我们django中写CBV的时候继承的是View,rest_framework继承的是APIView,那么他们两个有什么不同呢~~~ urlpatterns = [ ...
- 2018-6-8随笔-combox绑定-语音-删空格
1.下面介绍三种对comboBox绑定的方式,分别是泛型中IList和Dictionary,还有数据集DataTable ----->>>>>飞机票 2. 简单的语音播报 ...
- Spring MVC ,使用mvc:resources标签后,处理器无法被访问
在SpringMVC的配置文件中添加了<mvc:resources mapping="/img/**" location="/img/"/>以便处理 ...
- Flask实例化配置
template_folder :指定模板存放路径,默认值:temolates from flask import Flask, url_for app = Flask(__name__,templa ...