vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Database query needed (https://vborg.vbsupport.ru/showthread.php?t=320079)

Dave 09-10-2015 07:46 PM

What are the exact errors you are facing?
Also, do not use quotes around the database/table name, that is not valid SQL.

RichieBoy67 09-11-2015 06:21 AM

The error is:
PHP Code:


INSERT INTO 
"muscle-mecca-BackUp.post" (SELECT FROM meccaaugust-backup.post WHERE threadid IN (SELECT threadid FROM "muscle-mecca-BackUp.thread"))          MySQL said: [img]https://vborg.vbsupport.ru/[/img] 
  #1064 - You have an error in your SQL syntax; check the manual that  corresponds to your MySQL server version for the right syntax to use  near '"muscle-mecca-BackUp.post"
(SELECT *
FROM meccaaugust-backup.post
WHERE threa
' at line 1 

When I ran this:

PHP Code:


INSERT INTO 
"muscle-mecca-BackUp.post"
(SELECT *
FROM meccaaugust-backup.post
WHERE threadid IN 
(SELECT threadid FROM "muscle-mecca-BackUp.thread")) 

when I ran on the live database:

PHP Code:


muscle
-mecca-BackUp 

Thanks

Dave 09-11-2015 08:10 AM

Yes you get that error because you wrap your database and table name in quotes. Remove the quotes.

RichieBoy67 09-11-2015 08:30 AM

I will rerun it but I got the same type of error before I added those.

--------------- Added [DATE]1441967876[/DATE] at [TIME]1441967876[/TIME] ---------------

Ok,

ran:
PHP Code:


INSERT INTO muscle
-mecca-BackUp.post
(SELECT *
FROM meccaaugust-backup.post
WHERE threadid IN 
(SELECT threadid FROM muscle-mecca-BackUp.thread)) 


Got:
PHP Code:


INSERT INTO muscle
-mecca-BackUp.post (SELECT FROM meccaaugust-backup.post WHERE threadid IN (SELECT threadid FROM muscle-mecca-BackUp.thread))          MySQL said: [IMG]https://74.208.174.189:8443/domains/databases/phpMyAdmin/themes/dot.gif[/IMG] 
  #1064 - You have an error in your SQL syntax; check the manual that  corresponds to your MySQL server version for the right syntax to use  near '-mecca-BackUp.post
(SELECT *
FROM meccaaugust-backup.post
WHERE threadid IN 
(' at line 1 

--------------- Added [DATE]1441969060[/DATE] at [TIME]1441969060[/TIME] ---------------

not sure why but cant edit this

Dave 09-11-2015 09:15 AM

I have a feeling it's messing up because you have dashes in your database name. Is it possible for you to rename it to something else, alphanumeric characters only? Then try it again.

squidsk 09-11-2015 01:30 PM

Try this query. The database needs to be backticked seperately from the table name, and I've added IGNORE after INSERT.

Code:


INSERT IGNORE INTO `muscle-mecca-BackUp`.`post`
(SELECT *
FROM `meccaaugust-backup`.`post`
WHERE threadid IN (SELECT threadid FROM `muscle-mecca-BackUp`.`thread`))


RichieBoy67 09-12-2015 12:06 AM

Error says select command denied for user.. I think I know the issue though. I need both databases to use the same user. Right?

Ok, think I got it.. Checking now!

Thanks

--------------- Added [DATE]1442031673[/DATE] at [TIME]1442031673[/TIME] ---------------

Very strange, this did work on the back ups but now I change the name and am getting an error saying the post table doesn't exist.

######.post table doesn't exist This is for the live database, not the back up. I do not understand it.

--------------- Added [DATE]1442049184[/DATE] at [TIME]1442049184[/TIME] ---------------

Ok, I got it. I believe the last issue had something to do with the log for that table. I ended up copying that entire database to a new one and then running the last query there. Perfect!

This actually leads me to a new topic I will be posting about which is how and why my site actually started ranking better and getting more traffic after almost 400,000 posts were removed.

Thanks!


All times are GMT. The time now is 03:25 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01628 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete