存档
MySQL跨时区迁移数据的解决方法,重要!
问: 如果数据表中有时间字段,现在要迁移到其他时区的服务器上,该如何处理呢?
答:在高版本的mysqldump中,新增了一个选项:–tz-utc,默认是启用的,来看看它的说明
mysql使用普通用户备份出现:
[root@centos ~]# mysqldump -h 192.168.4.28 -uuser_intra -ppassword HR > 1.sql
mysqldump: Got error: 1045: Access denied for user ‘user_intra’@’192.168.4.225′
#!/bin/sh
#Mysql start|stop|restart
#Created by ritto
#20081120
mysql_port=$2
mysql_username=“root”
mysql_password=“123456″
mysql_port=“3306″
平时进入MySQL时总要输入很长的命令,把MySQL的路径加入到默认的环境变量中去以后就很方便了。
若要永久生效
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile //永久修改的
source /etc/profile
转载于我同事David.Yang写的 MySQL主从复制一文,再稍做修改的,原文地址http://blog.chinaunix.net/u/29134/showart_1711722.html
All the info below should be added in /etc/my.cnf. If you can’t find this file, just use the following statements to find where it is.
- To find the location of my.cnf.
ps -ef | grep mysql | grep -v ‘grep’ | head -1
For example .
[root@ritto /]# ps -ef | grep mysql | grep -v ‘grep’ | head -n 1
root 2776 2494 0 03:47 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe –defaults-file=/usr/local/mysql/my.cnf
1.登陆mysql
[root@ritto /]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
<1>.创建用户
mysql> insert into mysql.user(host,user,password) values(‘%’,'ritto’,password(’123456′));
//刷新系统权限表
mysql> flush privileges;
确切地说这是在增加一个用户,用户名为ritto,密码为123456。注意要使用PASSWORD函数,然后还要使用FLUSH PRIVILEGES来执行确认。
论坛MySQL数据库的一张MySQL表损坏。根据经验,成功修复MySQL损坏表的概率是90%,没有必要去用旧的数据库备份去恢复。 方法很简单,四步即可搞定。
①、用root帐号从命令行登录MySQL: mysql -u root -p
②、输入root帐号的密码。
③、选定数据库名(本例中的数据库名为studentmis): use studentmis;
④、修复损坏的表(本例中要修复的表为smis_user_student):
repair table smis_user_student;
近期评论