mysql数据库的系统操作基本操作

本文主要总结并记录一下简单且常用的mysql 在cmd 窗口中操作的基本命令

命令停止mysql 数据库服务

1.(cmd)命令行

启动:net start mysql
停止:net stop mysql

2.手动: 1. 使用快捷键 ctr+alt+delete  =》2. 启动任务管理器=》3. 进入服务 =》4.找到mysql 将其启动/关闭


3.登录/退出mysql系统

登录:mysql -h服务器路径 -u登录名 -p

或者登录:mysql --host=服务器地址 --user=用户名 --port=端口 --password

例子:mysql -hlocalhost -uroot -p

或者:mysql --host=hlocalhost --user=root --port=3066 --password=123456
//(注意:前提是系统环境设置好)

4.备份与恢复

//4.1备份:
语法:mysqldump -h服务器地址 -u登录名 -p 数据库名> 文件名
例子:mysqldump -hlocalhost -uroot db>e:/db.sql

//4.2恢复:
语法:mysql -h服务器地址 -u登录名 -p 数据库名<文件名
例子:mysql -hlocahost -uroot -p db2<e:/db.sql
原文地址:https://www.cnblogs.com/beyonds/p/9017464.html