mysqldump

How does phpMyAdmin Export work?

房东的猫 提交于 2019-11-30 10:07:42
Couldn't find a good answer to my question anywhere. If I were to want to create a php function that does the same thing as the Export tab in phpMyAdmin, how could I do it? I don't know if there is a mysql function that does this or if phpMyAdmin just builds the export file (in SQL that is) manually. Without shell access. Just using php. I tried the documentation for mysqldump , but that seemed to require using the shell (which I'm not quite sure what that even is -- maybe my question is How the heck do you use shell?). My silly idea (aren't they all?) is to allow non-technical users to build

Which are the proper privileges to mysqldump for the Error Access denied when executing 'SELECT INTO OUTFILE'.?

て烟熏妆下的殇ゞ 提交于 2019-11-30 08:51:27
backup user has BackupAdmin role and ALL privileges (object rights, DDL, GRANT). cmd> mysqldump --routines=TRUE --tab=C:\tmp -h localhost -u backup -pbackup schemalocal cmd> mysqldump: Got error: 1045: Access denied for user 'backup'@'%' (using password: YES) when executing 'SELECT INTO OUTFILE' The only way to make it work is to give DBA role to backup account, but that is a security risk so I want to give it only the neccesary rights. Which are them? You need the FILE privilege in order to be allowed to use SELECT...INTO OUTFILE , which seems to be what mysqldump --tab uses to generate the

Problem with mysqldump: “--defaults-extra-file” option is not working as expected

蹲街弑〆低调 提交于 2019-11-30 07:48:50
I run the following command from the Windows command line to backup my database: ...\right_path\mysqldump --add-drop-database --databases my_database_name --defaults-extra-file=d:\1.cnf where d:\1.cnf contains the following: [client] user="my_user" password="my_password" Unfortunately, I got the following error message: mysqldump: unknown variable 'defaults-extra-file=d:\1.cnf' If I do: ...\right_path\mysqldump --add-drop-database --databases my_database_name --user="my_user" --password="my_password" it works as expected. What am I doing wrong ? I found the answer: --defaults-extra-file must

mysql dump 完全备

[亡魂溺海] 提交于 2019-11-30 07:42:30
创建表: MariaDB [xuegod]> create database xuegod; MariaDB [xuegod]> use xuegod; MariaDB [xuegod]> create table student(id int(20),name char(40),age int); 查看表结构 MariaDB [xuegod]> desc student; 基础操作 create table student(id int(20),name char(40),age int); 插入数据 insert into student values(2,'lis',24),(3,'wange',26); select * from student;查看数据表 select * from student\G #字段按行显示 select *from HA.student;#跨库查询 delete from students where id=3;#删除数据 delete from students where age is null; 删除adge为空的内容 update students set sex='M' where id=2;更新 select distinct name,age from student;#去重查询 select id,name,age from

InnoDB tables exist in MySQL but says they do not exist after copying database to new server

穿精又带淫゛_ 提交于 2019-11-30 07:29:14
I used mysqldump to export my database and then I imported it into MySQL on my other server. I can now see all my tables if I do "show tables" but I can't actually select from or describe any of them. ERROR 1146 (42S02): Table 'mydatabase.user' doesn't exist All of my tables are InnoDB. I saw one issue people had where they were using old_passwords, so I explicitly set that to 0 in my.cnf and I made sure all of the passwords in the mysql table were 41 hexadecimal digits as they should be for the new passwords. RolandoMySQLDBA The reason "show tables;" works is because mysqld will scan the

Fix serialized data broken due to editing MySQL database in a text editor?

浪子不回头ぞ 提交于 2019-11-30 06:47:37
Background: I downloaded a *.sql backup of my WordPress site's database, and replaced all instances of the old database table prefix with a new one (e.g. from the default wp_ to something like asdfghjkl_ ). I've just learnt that WordPress uses serialized PHP strings in the database, and what I did will have messed with the integrity of the serialized string lengths. The thing is, I deleted the backup file just before I learnt about this (as my website was still functioning fine), and installed a number of plugins since. So, there's no way I can revert back, and I therefore would like to know

mysqldump with --where clause is not working

匆匆过客 提交于 2019-11-30 06:21:56
mysqldump -t -u root -p mytestdb mytable --where=datetime LIKE '2014-09%' This is what I am doing and it returns: mysqldump: Couldn't find table: "LIKE" I am trying to return all the rows where the column datetime is like 2014-09 meaning "all September rows". You may need to use quotes: mysqldump -t -u root -p mytestdb mytable --where="datetime LIKE '2014-09%'" Timofey Bugaevsky Selecting dates using LIKE is not a good idea. I saw this method in one project. This causes huge DBMS load and slow system operation as no index by this table column used. If you need to select date range use between:

How to copy table between two models in Mysql workbench?

邮差的信 提交于 2019-11-30 06:17:36
I am doing some databese thing, I need copy one table from one model to another, but i try many ways there no effect. Is there any way for doing this? Your best option is probably to create a stripped down version of the model that contains the objects you want to carry over. Then open the target model and run File -> Include Model... . Select the stripped down source model and there you go. If you just want to do a single table through the MySQL Workbench. In MySQL Workbench: Connect to a MySQL Server Expand a Database Right Click on a table Select Copy To Clipboard Select Create Statement A

Create table if not exists from mysqldump

偶尔善良 提交于 2019-11-30 06:01:33
I'm wondering if there is any way in mysqldump to add the appropriate create table option [IF NOT EXISTS]. Any ideas? According to one source , mysqldump does not feature this option. You could use the --force option when importing the dump file back, where MySQL will ignore the errors generated from attempts to create duplicate tables. However note that with this method, other errors would be ignored as well. Otherwise, you can run your dump file through a script that would replace all occurrences of CREATE TABLE with CREATE TABLE IF NOT EXISTS . Pawel Try to use this on your SQL file: sed 's

Create MySQL Database with .SQL File

给你一囗甜甜゛ 提交于 2019-11-30 05:22:06
I don't know much about MySQL at all. But I am trying to reverse engineer a MySQL database using Visio. I know what steps I should take to do this, but I can't get my database to show in the 'Databases' section (as below): How do I create the MySQL database using the .SQL file and get it to show up in this list? I have tried this code: mysql -u username -p password database_name < filename.sql using my own credentials of course. But that doesn't seem to work. In what folder should the .SQL file be placed if this statement is to work? rizzz86 1) Create a file "filename.sql" 2) Create a database