Solved

mysql dump - changing Upper case to lower case on move?

Posted on 2007-11-22
5
3,704 Views
Last Modified: 2013-12-13
Hello! Me Again, have a new thing stumping me.....


we have 2 MySQL systems, a mysql dump is used, coded in PHP to copy data from one server to another server, now when this script was running, it used to copy from Windows to a LInux system, now the LInux system is being replaced temp, with a Windows box, now switching the script to point to this new server when it runs, when it creates the folder on the new windows box, it makes the folder name with a small letter as opposed to a capital (the original soure has a capital A)

Here is the script being used, is there somethign in it thatis making it change the Capital A to a small A? or is this some new setting / restriction in MySQL 5.0.45?

This file is run via a .bat file using php.exe, something that will remain for now so i need to figure out why it is making a small A, i could manually change it every day this run, but would prefer if it could fully work.


<?
	$windows2=mysql_connect("****************","********","********");
	$windows=mysql_connect("****************","********","********");
	$dbwbases=mysql_query("show databases", $windows);
	$dblbases=mysql_query("show databases",$windows2);
	$windows2bases=array();
	$windowsbases=array();
	while ($lbases=mysql_fetch_row($dblbases))
	{	
		array_push($windows2bases,$lbases[0]);
	
	}
	
	while ($wbases=mysql_fetch_row($dbwbases))
	{
		
		if (($wbases[0]<>"mysql") and ($wbases[0]>'Archive-2005-11-28-04-31'))
		{
			
			//$Archivename=substr($wbases[0],0,7).substr($wbases[0],8,4).substr($wbases[0],13,2).substr($wbases[0],16,2).substr($wbases[0],19,2).substr($wbases[0],22,2).substr($wbases[0],25,2);
			$Archivename="A";
			$Archivename.=substr($wbases[0],1,6).substr($wbases[0],8,4).substr($wbases[0],13,2).substr($wbases[0],16,2).substr($wbases[0],19,2).substr($wbases[0],22,2).substr($wbases[0],25,2);
			array_push($windowsbases,$Archivename);
			if (!in_array($Archivename,$windows2bases))
			{
				
				mysql_query("create database $Archivename",$windows2);
				print("Moving $wbases[0] to $Archivename...");
				exec("mysqldump --opt -h **************** -u ******** $wbases[0] | mysql --host=**************** --user=******** -C $Archivename");
				print("Complete\n");
			
				
			}
		}
	
	
	}
	/* $diffbases=array_diff($windows2bases,$windowsbases);
	foreach ($diffbases as $d)
	{
	
		mysql_query("drop database $d");
		print("Dropping $d....\n");
	
	} */
	$db_list = mysql_list_dbs($windows2);
	while ($database=mysql_fetch_object($db_list))
	{
		$dbase=$database->Database;
		if (strlen($dbase)>18)
			{$realdbase=$dbase;} 
			//get the latest Archive name
	}
	//exec("mysqldump --opt -h **************** --user=******** $realdbase | mysql --host=**************** --user=outside -C ********");
?>

Open in new window

0
Comment
Question by:Mathiau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20337214
mysql databases on windows boxes do not use upper case. create a database called "MyBase" in phpMyAdmin on Windows, and you will see what I mean
0
 
LVL 25

Accepted Solution

by:
imitchie earned 125 total points
ID: 20337219
http://mysql2.mirrors-r-us.net/doc/refman/5.0/en/identifier-case-sensitivity.html

mysql on Windows will lowercase it for you automatically
0
 
LVL 2

Author Comment

by:Mathiau
ID: 20337367
is there any way to remove that auto feature? daily we extract archived files and we use a Capital A and have for about 6 years now, some scripts are written to look for the spefic name, and if i read MySQL site right, certain things are case sensitive.. on windows?


Just found this


Use lower_case_table_names=0 on Unix and lower_case_table_names=2 on Windows. This preserves the lettercase of database and table names. The disadvantage of this is that you must ensure that your statements always refer to your database and table names with the correct lettercase on Windows. If you transfer your statements to Unix, where lettercase is significant, they do not work if the lettercase is incorrect.


0
 
LVL 2

Author Comment

by:Mathiau
ID: 20337396
woo hoo

adding lower_case_table_names=2 to the my.ini did the trick :) thank you for the info and the link!
0
 
LVL 2

Author Closing Comment

by:Mathiau
ID: 31410593
Answer i true, link was very useful (seemed just slight diff then the one i was looking at) but had the info needed to fix this.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question