易截截图软件、单文件、免安装、纯绿色、仅160KB

遇到的一个mysql备份恢复的问题

数据库特点
--使用partition,存在上百个分区
--建表时指定了data_dir和index_dir,数据不是存储在默认位置,而是在mysqld的数据目录下link到真正的数据文件
备份恢复要求
--备份出来的数据恢复时要恢复成不同的表名
--恢复出来的数据实际存储位置也要存储在与原表不同的位置
问题
如果直接mysqldump-source恢复-change table name,则新表的存储位置无法满足要求,link到的位置必然是错误的,需要修改mysqld数据目录下的数百个软链接
备份过程
mysqldump -uroot -p$dbpassword -h$srcip $dbname $tablename > $tablename.data
信息修改过程
sed -e "s/$origname/$newname/g" $tablename.data > $tablename.data.tmp1
rm -f $tablename.data
sed -e "s/$origloc/$newloc/g" $tablename.data.tmp1 > $tablename.data.tmp2
rm -f $tablename.data.tmp1
mv $tablename.data.tmp2 $tablename.data
恢复过程
mysql -u$dbuser -p$dbpassword -h$destip -e"$createdbsql"
mysql -u$dbuser -p$dbpassword -h$destip $dbname -e"source $tablename.data"


相关文档:

Ubuntu下配置网络,安装mysql,jdk

sudo apt-get install mysql-server mysql-client
sudo apt-get install sun-java6-jdk(安装出意外,sudo dpkg -P sun-java6-bin,然后重新安装)
sudo vi /etc/network/interfaces 配置网络
auto eth0
iface eth0 inet dhcp(static)
address 192.168.8.108
netmask 255.255.255.0
gateway 192.168.8.1
:x保存
sud ......

PHP新的连接MySQL方法mysqli

PHP新的连接MySQL方法mysqli
1. 开启PHP的API支持
(1)首先修改您的php.ini的配置文件。
      查找下面的语句:
      ;extension=php_mysqli.dll
      将其修改为:
      extension=php_mysqli.dll
......

Mysql数据库导出方法

导出整个数据库:mysqldump -u用户名 -p密码 需要导出的数据库名 > 导出文件名.sql
其他参数:
-d 不包含数据,只有数据库表结构
--add-drop-table 在每个create语句之前增加一个drop
--skip-opt 每条记录只对应一个insert语句 ......

Quick Test Setup of MySQL Cluster


To familiarize you with the basics, we will describe the simplest
possible configuration for a functional MySQL Cluster. After this,
you should be able to design your desired setup from the
information provided in the other relevant sections of this
chapter.
......

MySQL Cluster Configuration — Basic Example


To support MySQL Cluster, you will need to update
my.cnf
as shown in the following example.
You may also specify these parameters on the command line when
invoking the executables.

Note
The options shown here should not be confused with thos ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号