MySql dump操作教程

版权声明:转载 MySql dump操作教程 时请以超链接形式标明文章出自 正确的方法 !!!
https://cn.chinese-blog.org/mysql-dump-cao-zuo-jiao-cheng/

How do I access MySQL using SSH?

To Access MySQL Using SSH (Plesk not installed) Log on to your server. At the command line, type su –. This gives you root access. At the command line, type mysql -uroot -p Enter your MySQL root password. NOTE: MySQL’s default root password is an empty string (no password is set). http://help.godaddy.com/topic/94/article/1230

作者 海云青飞:哲学家,生命科学家,传统文化第一人,唯一悟道者 《悟道相对论》《中医有毒吗》《黄帝内经是真的吗》《父母怎么教育孩子》

How do I reset my MySQL Password on my Dedicated Linux Server?

To stop MySQL and restart in safe mode: At the command prompt, type the following commands and press Enter after each.

service mysqld stop
killall mysqld
mysqld_safe --skip-grant-tables&

To reset the admin password and permissions: At the command prompt, type the following command and press Enter.

mysql psa -e “flush privileges; grant all privileges on . to ‘admin’@‘localhost’ identified by "password” NOTE: Replace “password” with you Plesk or cPanel administrative password.

To stop safe mode and restart MySQL: At the command prompt, type the following commands and press Enter after each.

killall mysqld
service mysqld start

MySql 数据库自动备份脚本

http://digg.com/linux_unix/Mysql_Database_Backup_Script http://restkultur.ch/personal/wolf/scripts/db_backup/ Mysqldump is really a horrible way to backup a mysql database. It is a debugging, development, and migration tool, not a backup tool. It won’t even get you a coherent snapshot of the entire database at one time and it’s SLOOOOOOOOOW as a dog.

There are plenty of ways to do it “properly” but the simplest to explain is to just do a LOCK TABLES on all databases then do a file copy of the actual data in /var/lib/mysql (or whereever you have it). If you want to avoid any downtime at all, you can lock the tables and perform the backup from a seperate mysql server replicated from your primary data store. If you don’t want to run a second machine or second mysql server on the same machine and you can incur a second or two of downtime, you can put your data store onto an LVM or EVMS volume, LOCK TABLES, snapshot the disk, UNLOCK TABLES then backup from the volume snapshot. The LVM approach is a very elegant single-server approach that is straightforward and free.

There are also several commercial and noncomemrcial mysql backup solutions that do database snapshot/backup properly as well such as the InnoDB hot backup mentioned above.

http://www.v7n.com/forums/web-hosting-forum/50250-database-backup-godaddy.html Open notepad and turn word wrap off. (using this is optional, read all before proceeding)

GoDaddy空间 Mysql 操作

Log into your godaddy hosting control panel. Click on the mysql icon or tab. Select the database (DB) that you need to dump. Click on the open manager button. You will need to know the mysql username and password for the account. Enter them and click the button. This opens phpmyadmin. Click on the export link to dump the entire DB. Note that very large DBs may have to be dumped in sections. If in doubt try it. Make sure the sql button is selected Select SQL compatibility mode 4.xx is the most common. Under Structure I always check Add DROP TABLE Add IF NOT EXISTS This will drop existing tables and add them if they are not in the DB. Click the go button and wait for the screen to refresh. Copy the all text in the white box that starts with — phpMyAdmin SQL Dump to the bottom of the window. Paste that into your open notepad and save it as DBname.sql using all files . If it gets saved as a .txt no big deal.

You can also use the save as option at the bottom of the page on the left to save it to your local computer, but I like seeing the output which is why I do it the above way.

Now if you are not going to be able to get back there this is a good time to go ahead and dump it in a couple of more formats for backup. CSV, XML and Excel if you have it. These can be parsed with the correct software to recreate the database if need be.

Be sure to logout.

For the new server create a new database and you should be able to import the file directly from your local machine using the import button.

Some scripts, like wordpress store mail server information in some of the tables and the dump should be updated before it is restored.

If you don’t already have a copy of notepad2 this is a great time to download a free copy as it will let you open files.sql and save them with no hassle.

MySql dump命令的使用

mysqldump -h82.45.32.01 -uroot -pmypassword –opt name>name.sql

mysqldump -uroot -pmypass name < name.sql

用mysqldump对MySQL数据库进行数据备份与恢复2007-12-05 15:09数据库备份是很重要的。如果定期做好备份,这样就可以在发生系统崩溃时恢复数据到最后一次正常的状态,把损失减小到最少。MySQLl提供了一个mysqldump命令,我们可以用它进行数据备份,下面假设要备份tm这个数据库:

#mysqldump -u root -p tm > tm_050519.sql

按提示输入密码,这就把tm数据库所有的表结构和数据备份到tm_050519.sql了,因为要总进行备份工作,如果数据量大会占用很大空间,这时可以利用gzip压缩数据,命令如下:

#mysqldump -u root -p tm | gzip > tm_050519.sql.gz

系统崩溃,重建系统时,可以这样恢复数据:

#mysql -u root -p tm < tm_050519.sql

从压缩文件直接恢复:

#gzip < tm_050519.sql.gz | mysql -u root -p tm

导入数据库 常用source 命令 进入mysql数据库控制台, 如

mysql -u root -p 
mysql>use 数据库

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

mysql>source d:\wcnc_db.sql
MySql dump操作教程
https://cn.chinese-blog.org/mysql-dump-cao-zuo-jiao-cheng/

相关文章: