Home > Database > Mysql Tutorial > body text

MySQL数据库的导入导出与Linux的权限

WBOY
Release: 2016-06-07 16:53:05
Original
900 people have browsed it

1.导出整个数据库 mysqldump -u 用户名 -p 数据库名 gt; 导出的文件名 mysqldump -u wcnc -p smgp_apps_wcnc g

  1.导出整个数据库

  mysqldump -u 用户名 -p 数据库名 > 导出的文件名  

  mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql

  2.导出一个表

  mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名

  mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql

  3.导出一个数据库结构

   mysqldump -u wcnc -p -d --add-drop-table smgp_apps_wcnc >d:wcnc_db.sql

   -d 没有数据 --add-drop-table 在每个create语句之前增加一个drop table

  4.导入数据库

   常用source 命令

   进入mysql数据库控制台,,

   如mysql -u root -p

   mysql>use 数据库

   然后使用source命令,后面参数为脚本文件(如这里用到的.sql)

   mysql>source d:wcnc_db.sql

  alan发现有的时候source会出现乱码,尤其是在liunx下,也可以这样导入

   导入数据库 mysql -u root -p dbmane

  =====================================

   外加整理下liunx权限的命令,免的每次的都要一个目录一个目录的该权限

   -rwx------ :等于数字表示700。

   -rwxr—r--:等于数字表示744。

   -rw-rw-r-x:等于数字表示665。

   drwx—x—x:等于数字表示711。

   drwx------:等于数字表示700。

   chmod 777 /home/user  单目录权限

   chmod -R 777 /home/user  所有子目录

linux

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!