寻觅生命中的那一片浅草......

文章带标签 MySQL

MySQL – Got a packet bigger than ‘max_allowed_packet’

The default maximum allowed packget size is 1MB, so if you store some large binaries in your database you might get some problems. All you need to do is re-set the maximum size to a larger number.

Macintosh:trunk jennyfong$ mysql -uroot database_name < database_backup.sql

ERROR 1153 (08S01) at line 2365: Got a packet bigger than ‘max_allowed_packet’ bytes
Macintosh:trunk jennyfong$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 5.0.86 MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> set global net_buffer_length=10000000;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> set global max_allowed_packet=1000000000;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
Macintosh:trunk jennyfong$ mysql -uroot database_name < database_backup.sql

show variables like ‘max_allowed_packet’;

install_xtrabackup-1.0_on_CentOS_5.4

wget http://www.percona.com/mysql/xtrabackup/1.0/source/xtrabackup-1.0-56.rhel5.src.rpm
mkdir -p /usr/src/redhat/SOURCES/
rpm -i xtrabackup-1.0-56.rhel5.src.rpm
cd /usr/src/redhat/SOURCES/
tar xf xtrabackup-1.0.tar.gz
cd xtrabackup-1.0
./configure
make
cd innobase/xtrabackup/
make
make install

/usr/bin/innobackupex-1.5.1 –help

Got error 28 from storage engine 解决方法

今天碰到数据库出错

Got error 28 from storage engine

查了一下,数据库文件所在的盘应该没事,应该是数据库用的临时目录空间不够

引用
磁盘临时空间不够导致。
解决办法:
清空/tmp目录,或者修改my.cnf中的tmpdir参数,指向具有足够空间目录

上面的说法应该比较清楚,还有一个类似的:

引用
mysql报以下错的解决方法

ERROR 1030 (HY000): Got error 28 from storage engine

出现此问题的原因:临时空间不够,无法执行此SQL语句

解决方法:将tmpdir指向一个硬盘空间很大的目录即可

原创内容如转载请注明:来自 阿权的书房
本帖地址:http://www.aslibra.com/blog/read.php/794.htm

Windows下mysqlimport批量txt文件

在Linux上把MySQL库导出为sql和txt,在Linux上是很容易导入

mysql -u root -ppassword dbname < db_struc.sql

mysqlimport –local -uroot -ppassword dbname `find . -name “*.txt”`

Windows下麻烦了,没有find,又不支持*.txt

后来想到办法,建了个bat文件

用替换的方法将文件修改为

mysqlimport -uroot -ppassword dbname d:\dump\table1.txt

mysqlimport -uroot -ppassword dbname d:\dump\table2.txt

进入cmd
c:
cd “\Documents and Settings\user\桌面\test_2011-03-10\2011-03-10”
创建数据库test
“F:\Program Files\xampp\xampp\mysql\bin\mysql.exe” -uroot -pmanypassword
CREATE DATABASE IF NOT EXISTS test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
exit

导入数据结构
“F:\Program Files\xampp\xampp\mysql\bin\mysql.exe” -uroot -pmanypassword test < test_db_struc.sql
获取所有表的txt文件名
dir /b *.txt > c:\import.bat
现在的格式是
test_data.txt
test_data_a.txt

然后用editplus打开,替换成这样的格式
“F:\Program Files\xampp\xampp\mysql\bin\mysqlimport.exe” –local -uroot -pmanypassword test test_data.txt
“F:\Program Files\xampp\xampp\mysql\bin\mysqlimport.exe” –local -uroot -pmanypassword test test_data_a.txt

把import.bat放到c:\Documents and Settings\user\桌面\test_2011-03-10\2011-03-10
执行,数据就导进去了

mysql_drop_user错误

mysql> drop user ‘test_s99’@’%’;
ERROR 1268 (HY000): Can’t drop one or more of the requested users

revoke all on test_s99.* from ‘test_s99’@’localhost’;
drop user ‘test_s99’@’localhost’;

The DROP USER statement removes one or more MySQL accounts. To use it, you must have the DELETE privilege for the mysql database. Each account is named using the same format as for the GRANT  statement; for example, ‘jeffrey’@’localhost’. If you specify only the user name part of the account name, a host name part of ‘%’ is used. For additional information about specifying account names, see Section 12.5.1.2, “GRANT Syntax”.

DROP USER was added in MySQL 4.1.1. In MySQL 4.1, it serves only to remove account rows from the user table for accounts that have no privileges. To remove a MySQL account completely (including all of its privileges), you should use the following procedure, performing the steps in the order shown:

1.

Use SHOW GRANTS to determine what privileges the account has. See Section 12.5.5.12, “SHOW GRANTS Syntax”.
2.

Use REVOKE to revoke the privileges displayed by SHOW GRANTS. This removes rows for the account from all the grant tables except the user table, and revokes any global privileges listed in the user table. See Section 12.5.1.2, “GRANT Syntax”.
3.

Delete the account by using DROP USER to remove the user table row.

In MySQL 5.0.2 and up, DROP USER removes the account row in the user table and also revokes the privileges held by the account. It is not necessary to use DROP USER in conjunction with REVOKE.
Important

DROP USER does not automatically close any open user sessions. Rather, in the event that a user with an open session is dropped, the statement does not take effect until that user’s session is closed. Once the session is closed, the user is dropped, and that user’s next attempt to log in will fail. This is by design.

Before MySQL 4.1.1, DROP USER is not available. You should first revoke the account privileges using SHOW GRANTS and REVOKE as just described. Then delete the user table row and flush the grant tables as shown here:

http://dev.mysql.com/doc/refman/4.1/en/drop-user.html

2024年五月
« 5月    
 12345
6789101112
13141516171819
20212223242526
2728293031