Cannot copy database or import exported database script - mysql

I'm trying to copy a database.
From PHPMyAdmin, I've tried both the copy database functionality and the importing of an exported script. In both cases, I get this:
#1054 - Unknown column 'e.request_id`request_id' in 'group statement'
After the copy/import, since the error above relates to views, they will be missing in the new database.
In the old database, the view works. If I run show create view my_view_name, paste into the SQL tab of the new database, the view gets created without any problems.
Any ideas why manually running the create view statement works, but not through the copy/import process?
Edit #1
I just spotted the issue above.
I'm assuming the database copy and export reuse the same SQL generation process? They both complain here - note the extra request_id in the export script:
GROUP BY `sl`.`intake_type_id`, `e`.`request_id``request_id` ;
The show create view doesn't produce the same code:
group by `sl`.`intake_type_id`,`e`.`request_id`
In the old database, when editing the view, I don't see any issues either:
GROUP BY
`sl`.`intake_type_id`,
`e`.`request_id`

I ended up manually fixing the produced SQL file to remove the issue with the group by and other tidbits.

Related

update mysql from a sql file

Im new to the php and mysql. I have been coding an auto update script. Everything works fine as I can download the latest version files from my own host which includes of the sql file of mysql. All I want to do an update due to this sql file.
What I want this code to do is;
If there is new tables, add it to the mysql and if we have deleted 1 table it can check and delete the same table from mysql.
But while we are doing this update, we will have so many entries under columns so I dont want it to update the columns which has entries in it. But if this is a column that we have deleted from the source sql file then it will delete it.
If there is new column on the source sql file then it will add that column to the mysql.
Any possibility can help me? Try to find if I can find something similiar but I couldnt see. Thats why I opened a topic here.
Thank you very much

Import MySQL file into Oracle SQL Developer

I have tried to find an answer for this elsewhere but cannot, I hope someone can help me.
I am trying to import the MySQL sample database into Oracle SQL Developer.
I have an existing database/connection I want to dump it into. I have created an empty table named classicmodels in my existing connection. Yes that name is only 1 table within the sample db, correct. Ignore the error in naming convention.
When I R-click on it and try 'import data' I cannot import a .sql file, I can only do it with XL, CSV, etc.
When I try and run a script it found on dba.stackexchange
#\path\mysqlsampledatabase.sql , I get a series of 'please provide substitution value' messages, which does not make sense to me given that I am importing a database which is built for SQL (ie what reason is there to substitute).
Pictures below:
The 'UnseenCollection' is a single table I imported as a csv file. I need to import the mysqlsampledatabase file such that it shows up the same way, I can access all tables within the sample db.
Anyone can help I would appreciate it. I need the end result to be the entire mysqlsampledatabase to populate within the 'classicmodels' node.
Thank you.
connect to MySQL
connect to Oracle
for a single MySQL table, right-click, 'Copy to Oracle'
for a few tables, select, drag and drop onto Oracle connection (requires newer version of SQL Developer)
for an entire MySQL database, use the migration project feature

How to run append query from data macro MS Access?

I have 2 table, one is local named 'Client' and other is a linked table to MySQL DB in my web-server named 'ClientSql'.
When I insert data into the table Client, I want it to be insert into clientSql too. I try it with data macro (after insert), but it shows me an error saying
It's not possible in linked tables.
I have tried to create an append query successfully, and it works, but it just works if I execute it manually. My question is:
Is it possible to call it from a data macro? if is possible, can you show me how? If not, can you point me to a solution?
I'm not sure why you should be able to do it manually, but not via a macro. According to this link
http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html
you should be able to do it either way.
Another thought is to eliminate the local access client table and have the access program update the mySql table directly. However, if another program is accessing the client table at the same time, this could become tricky due to multi-user and locking situations.

PHPMyadmin import CSV creates new table

I am trying to import some data into a MySQL 5.5.31 table from a CSV file using PHPMyadmin 4.0.0.
When I try to import, the import "works" but it creates a new table rather than imports into the current table - the new table is assigned a sequential name by PHPMyadmin and, whilst the data is viewable, the data is not usable as the table does not contain a unique column.
Here is a screenshot of the settings I am using to import which also shows I am trying to import into the table:
And here is the result I get from PHPMyadmin:
Any idea why this is happening? I have tried searching for the "The following structures have either been created or altered" message but found nothing here and only a few things on Google but none of the Google responses were of any help.
Not allowed to comment on Madhura Jayaratne's reply, but - because people trying to import ODS will look at this thread - it is worth pointing out that it is only partly correct. CSV has been fixed but the same bug still exists for ODS in phpMyAdmin 4.0.5.
This is a bug in phpMyAdmin and it has been fixed since version 4.0.1. See 14 item under 4.0.1.0 (2013-05-14) section of the change log file. Upgrade to 4.0.1 or a version greater than that.
Instead of phpmyadmin try SqlYog .SqlYog is userfriendly.Just try it

Import some database entries through PHPMyAdmin with overwrite

I exported a couple of entries from a database I have stored locally on my MySQL dbase through PhpMyAdmin and I'd like to replace only those entries on my destination database hosted online. Unfortunately when I try to do so PHPMyAdmin says that those posts already exist and therefore he can't erase them.
It'll take me a lot of time to search for those entries manually within the rest of the posts and delete them one at a time so I was wondering if there's any workaround in order to overwite those entries on import.
Thanks in advance!
A great option is to handle this on your initial export from phpMyAdmin locally. When exporting from phpMyAdmin:
Export method: Custom
Format: SQL
Format-specific options - choose "data" (instead of "structure" or "structure and data")
In Data creation options - Function to use when dumping data: Switch "Insert" to "Update" <-- This is the ticket!
Click Go!
Import into your production database. (always backup your production database before hand just in case)
I know this is an old post, but it actually helped me find a solution built into phpMyAdmin. Hope it helps someone else!
This is a quick and dirty way to do it. Others may have a better solution:
It sounds like you're trying to run INSERT queries, and phpMyAdmin is telling you they already exist. If you use UPDATE queries, you could update the info.
I would copy the queries you have there, into a text editor, preferably one that can handle find and replace, like Notepad++ or Gedit, and then replace some code to change the queries around from INSERT to UPDATE.
See: http://dev.mysql.com/doc/refman/5.0/en/update.html
OR, you could just delete them, then run your INSERT queries.
You might be able to use some logic with find and replace to make a DELETE query that gets rid of them first.
http://dev.mysql.com/doc/refman/5.0/en/delete.html
Check out insert on duplicate. You can either add the syntax to your entries stored locally, or import into a temporary database, then run an INSERT ... SELECT ... ON DUPLICATE KEY UPDATE. If you could post a schema, it would help us guide you better.