Home > Database > Mysql Tutorial > body text

Mysql常用命令行操作总结_MySQL

WBOY
Release: 2016-06-01 13:32:16
Original
1112 people have browsed it

bitsCN.com

Mysql常用命令行操作总结

 

1.导入某个sql文件到数据库:

用source命令,必须先登录到mysql控制台

mysql -u -p use xxxDatabase;source  /test.sql
Copy after login

2. 导出数据库表结构到sql文件

mysqldump -u root -p -d DBName >  dbName.sql
Copy after login

如果只想导出某个数据库表,则在数据库名字后面 加上表名字,多个以空格分开

3. 修改 Mysql 密码

mysqladmin -u 用户名 -p 旧密码 password 新密码
Copy after login

4. 连接Mysql 数据库

 mysql -h 主机地址 -u 用户名 -p  用户密码
Copy after login

5. 创建数据库,新建表,

  create database 库名;   create table 表名 
Copy after login

6. 删除库,删除表

drop database 库名;     drop table 表名
Copy after login

7. 表中记录清空

   delete from 表名;
Copy after login

 


bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template