mysqldump

#1071 - Specified key was too long; max key length is 1000 bytes

不问归期 提交于 2019-12-17 02:09:02
问题 I know questions with this title have been answered before, but please do read on. I've read thoroughly all the other questions/answers on this error before posting. I am getting the above error for the following query: CREATE TABLE IF NOT EXISTS `pds_core_menu_items` ( `menu_id` varchar(32) NOT NULL, `parent_menu_id` int(32) unsigned DEFAULT NULL, `menu_name` varchar(255) DEFAULT NULL, `menu_link` varchar(255) DEFAULT NULL, `plugin` varchar(255) DEFAULT NULL, `menu_type` int(1) DEFAULT NULL,

MySQL备份记录

ⅰ亾dé卋堺 提交于 2019-12-16 10:47:18
备份 命令行下具体用法如下: mysqldump -u用戶名 -p密码 -d 数据库名 表名 > 脚本名 ; 导出整个数据库结构和数据 mysqldump -h localhost -uroot -p123456 database > dump.sql 导出单个数据表结构和数据 mysqldump -h localhost -uroot -p123456 database table > dump.sql 导出整个数据库结构(不包含数据) mysqldump -h localhost -uroot -p123456 -d database > dump.sql 导出单个数据表结构(不包含数据) mysqldump -h localhost -uroot -p123456 -d database table > dump.sql 数据还原 1、还原使用mysqldump命令备份的数据库的语法如下: mysql -u root -p [dbname] < backup.sq 示例: mysql -u root -p < C:\backup.sql 来源: CSDN 作者: 一条肥鱼 链接: https://blog.csdn.net/asahinokawa/article/details/89515034

mysql 常用命令汇总

ぃ、小莉子 提交于 2019-12-16 00:26:12
mysql修改用户密码的几种方法: 方法1: 用SET PASSWORD命令 首先登录MySQL。 格式:mysql> set password for 用户名@localhost = password('新密码'); 例子:mysql> set password for root@localhost = password('123'); 方法2:用mysqladmin 格式:mysqladmin -u用户名 -p旧密码 password 新密码 例子:mysqladmin -uroot -p123456 password 123 方法3:用UPDATE直接编辑user表 首先登录MySQL。 mysql> use mysql; mysql> update user set password=password('123') where user='root' and host='localhost'; mysql> flush privileges; 方法4:在忘记root密码的时候,可以这样 1.编辑vi /etc/my.cnf 2.最后一行添加mysqld --skip-grant-tables ###--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。 use MySQL; 改密码:update user set password

关于mysqldump进行跨机备份遇到的问题

戏子无情 提交于 2019-12-14 23:40:31
首先安装mysql,这里就不多比比,设置用户名和密码 mysqladmin -u root password "123456" 在执行mysqldump时遇到 mysqldump: Got error: 1130: Host '172.16.1.73' is not allowed to connect to this MySQL server when trying to connect 一开始以为是防火墙阻拦,所以执行 /sbin/iptables -A INPUT -p tcp -s 172.16.1.73 -j ACCEPT /sbin/iptables -A INPUT -p udp -s 172.16.1.73 -j ACCEPT 发现没有效果 在mysql中执行(ii为我自己的数据库名字) grant select on ii.* to root@'172.16.1.73' 发现问题解决 来源: CSDN 作者: qq_41353537 链接: https://blog.csdn.net/qq_41353537/article/details/103543767

MySQL Backup with WHERE Condition

拥有回忆 提交于 2019-12-14 04:19:27
问题 Is it possible to backup a MySQL Table with a WHERE Condition? For example, I have a table with a date AND time column. Now I want to backup that table with date >= '2013-08-01'. What I have in mind is to SELECT the data I needed to a temporary table then backup that temporary table. Is there any other way? 回答1: TRY this : $db_user = "username"; $db_pass = "password"; exec("mysqldump --opt -u$db_user -p$db_pass --no-create-info --where date >= '2013-08-01' my_database my_table > backup.sql");

mysqldump store null as blank

无人久伴 提交于 2019-12-14 02:33:40
问题 I use mysqldump to create a dump of my data table. The only problem is, that mysql stores a null value as /N and if I want to import the created CSV file into HANA, /N is not known as null but as varchar. Is there a way to skip the null values during dumping or can I just replace /N with a blank? 回答1: As far as I know,there are no options for handling the output of NULLs. You could try to replace NULLs with empty in your table: UPDATE `tablename` SET columnname= '' where columnname is null 来源

MySQL select query conditions

烈酒焚心 提交于 2019-12-13 21:54:16
问题 Hello, I have the following sql table + data: CREATE TABLE IF NOT EXISTS `job_requires` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `Job_id` bigint(20) unsigned NOT NULL, `Group_Index` int(11) NOT NULL, `Field_id` bigint(20) unsigned NOT NULL, `Field_Value` int(11) NOT NULL, PRIMARY KEY (`id`) ) INSERT INTO `job_requires` (`id`, `Job_id`, `Group_Index`, `Field_id`, `Field_Value`) VALUES (1, 7, 1, 11, 50), (2, 7, 1, 14, 50), (3, 7, 1, 11, 59), (4, 7, 2, 14, 1), (5, 7, 2, 11, 2), (6, 8,

Linux下数据库表结构导入导出

只谈情不闲聊 提交于 2019-12-13 16:48:41
1、导出数据库为dbname的表结构(其中用戶名為root,密码为dbpasswd,生成的脚本名为db.sql) mysqldump -h(指向的IP地址) -P(端口) -uroot -pdbpasswd -d dbname >db.sql; 2、导出数据库为dbname某张表(test)结构 mysqldump -h(指向的IP地址) -P(端口) -uroot -pdbpasswd -d dbname test>db.sql; 3、导出数据库为dbname所有表结构及表数据(不加-d) mysqldump -h(指向的IP地址) -P(端口) -uroot -pdbpasswd dbname >db.sql; 4、导出数据库为dbname某张表(test)结构及表数据(不加-d) mysqldump -h(指向的IP地址) -P(端口) -uroot -pdbpasswd dbname test>db.sql; 5.导出数据中dbname多张表(test1,test2,test3)结构及表数据用用空格隔开 mysqldump -h(指向的IP地址) -P(端口) -uroot -pdbpasswd dbname test1 test2 test3>db.sql; 6、执行SQL脚本 source xxx.sql 来源: CSDN 作者: weixin_42553714 链接:

Moving mysql files across servers

送分小仙女□ 提交于 2019-12-13 16:15:04
问题 I have a massive MySQL database (around 10 GB), and I need to copy it to a different server (slicehost). I don't want to do a DB dump and reimport b/c I think that would take forever. Is it possible to just move the raw SQL files from one machine to the next, setup an identical mysql server, and flip the switch? 回答1: It should work. This is the principle that the mysqlhotcopy tool uses, although this tool is meant to be run while the server is operating. 回答2: Generally, yes. It's preferable

How to restore a specific table from mysqldump

血红的双手。 提交于 2019-12-13 14:09:37
问题 I have a mysqldump file which was taken using the following command. mysqldump -u root --password=<passwd> 'gss-app' table1 table2 ... tableN --skip-triggers --skip-add-drop-table --skip-lock-tables --compact --no-create-info --quick | bzip2 -c > /var/backups/gss-app.sql.bz2 I have decompressed the dump and want to restore a table named sd_images . As the create table and drop table statements are skipped in the command used the dump file starts INSERT INTO table_name for each table. Could