473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to upload mysql database to my serverspace in programming

16
how to upload mysql database to my server space (hostgator,bluehost) in programming method.any one can help me to do this.


Thanks in Advance
Sep 22 '10 #1
12 2124
code green
1,726 Expert 1GB
mysqldump to produce a SQL file
FTP the SQL file.
Run the SQL on the server space
Sep 22 '10 #2
neelsbr
16
How to run sql in server space.suppose i runs ,if any changes to be done in my database
Sep 23 '10 #3
code green
1,726 Expert 1GB
You run files and maintain a database on a remote server the same as you would locally.
The remote scripts can be run through a local browser or on a Cron/Sched Task remotely
Sep 23 '10 #4
neelsbr
16
thanks for your reply.i am using select out file query export data in my local system and load data in file query to import data.i m connecting to server from my local system.load data infile query is not executing.data are not imported in my server database.but that load data infile query works in my local system.can you please help me .

Thanks
Sep 23 '10 #5
code green
1,726 Expert 1GB
'Is not working' is not very helpful.
There could be a multitude of reasons depending on your set-up.
You need to check whayt erors are being returned
Sep 23 '10 #6
neelsbr
16
no errors would returned.load data infile query is not working.i checked that.i give the correct path,where i stored the sql file.this is the path i given backup/$table[$i].sql.table name comes automatically it runs through the loop
Sep 27 '10 #7
neelsbr
16
i find out the problem.i want to get the sql file from mysql/data/backup/table1.sql.My programs under( htdocs/test/test.php).htdocs directory.Now please help me to access that file.If i can access that file then ,the query will work.

Thanks
Sep 27 '10 #8
code green
1,726 Expert 1GB
I don't understand which file you are trying to access or from where.
Do you mean you want to run test.php?
Or do you mean you want test.php to run the .sql file.

From where are you running these scripts, on the server itself or remotely.

Either way what do you mean by
Now please help me to access that file
Sep 27 '10 #9
neelsbr
16
I am running test.php to execute a sql file.i am running program in my local system.please help me to how to access that particular file in my local system. sql files comes under this path C:\xampp\mysql\data\backup.i want access the sql file in the above path.i understand the problem .the path is not given correctly.
thank u
Sep 28 '10 #10
code green
1,726 Expert 1GB
Please supply the code you are trying
running test.php to execute a sql file
and the errors being returned that report an incorrect path
the path is not given correctly
Sep 28 '10 #11
neelsbr
16
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  require_once('library/config.php');
  3.  
  4. $dbHost = 'localhost';
  5. $dbUser = 'username';
  6. $dbPass = 'password';
  7. $dbName = 'dbname';
  8.  
  9. $today=date('Y/m/d');
  10.  
  11. $table=array('m_couponbook','m_discount','m_grade','m_kart','m_member','m_nonmember','m_publicholiday','m_rate','m_staff','t_billing','t_billingpenalty','t_cancelbilling','t_couponissue','t_duplicateaccesscard','t_groupbilling','t_groupbooking','t_memberattendance','t_memberpayment','t_raceallocation','t_raceevent','t_raceparticipation','t_performance','t_sponsorshipregistration','t_staffattendance');
  12.  $count=count($table);
  13. for($i=0;$i<$count;$i++)
  14. {
  15.  
  16. $backupFile = "backup/$table[$i].sql";
  17. $query      = "SELECT * INTO OUTFILE '$backupFile' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' FROM `$table[$i]`";
  18. $result = dbQuery($query);
  19.  
  20. }
  21.  
  22. /*$backupFile = $dbName . date("Y-m-d-H-i-s")  .'.gz';;
  23. echo $command = "mysqldump --opt -h $dbHost -u $dbUser -p $dbPass $dbName | gzip > $backupFile";
  24. system($command);*/
  25.  
  26. // hostname or ip of server
  27. $servername='box.bluehost.com';
  28.  
  29. // username and password to log onto db server
  30. $dbusername='username';
  31. $dbpassword='password';
  32.  
  33. // name of database
  34. $dbname='dbname';
  35.  
  36. ////////////// Do not  edit below/////////
  37.  
  38. connecttodb($servername,$dbname,$dbusername,$dbpassword);
  39. function connecttodb($servername,$dbname,$dbuser,$dbpassword)
  40. {
  41. global $link;
  42. $link=mysql_connect ("$servername","$dbuser","$dbpassword");
  43. if(!$link){die("Could not connect to MySQL");}
  44. mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
  45. }
  46.  
  47. for($i=0;$i<$count;$i++)
  48. {
  49. $sql="TRUNCATE TABLE `$table[$i]`";
  50. $res=mysql_query($sql);
  51.  
  52. //$file = fopen("../mysql/data/backup/$table[$i].sql","r")or exit("Unable to open file!");
  53.  
  54. //some code to be executed
  55. //here i am getting sql files.this path has to be correct
  56. echo $backupFile = "../backup/$table[$i].sql";
  57.  
  58. $load="LOAD DATA INFILE '$file' INTO TABLE `$table[$i]` FIELDS TERMINATED BY ','";
  59. echo $result=mysql_query($load);
  60. //fclose($file);
  61. }
  62. //passthru("nohup mysql -u $dbusername -p $dbpassword $dbname < $backupFile");
  63. echo "success";
  64.  
  65. ?>
  66.  
this code i am using.i didn't get any error message for path not given correctly.i understood the path was not given correctly .so that only its not working .i already given the path,where my sql file stored.how can i access the files.
Sep 29 '10 #12
code green
1,726 Expert 1GB
I honestly don't understand your problem.
.i understood the path was not given correctly
If you know the path is wrong why don't correct it?
how can i access the files
Which files where?

I am guessing the SQL file is not being found, but then there would be an error message...
Try using full paths rather than relative
Sep 29 '10 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Geoff Soper | last post by:
I'm having problem with images becoming corrupted after loading them into a MySQL database and extracting them again. I'm pretty sure it's todo with escaping slashes but I'm at a loss as to how to...
1
by: windandwaves | last post by:
Hi Folk I want my clients to load up a file to a MySql database. The file should contain rows with name, email, address, city What would be the easiest way (in terms of the big picture), to...
1
by: den 2005 | last post by:
Hi Everybody, I am new at this group/forum. I am a .Net Programmer from Manila, Philippines. I like to ask anyone who can help me how to use mySQL database in programming Visual Studio .Net Smart...
0
by: goldwingers | last post by:
Have a large 153400 KB MySql database to upload and have to break it up into 2048KB pieces and upload it thru the MySql admin 1 piece at a time. Is there any software that can speed up breaking the...
3
by: AHMLIVE | last post by:
Hi everyone. I got a problem when i tried to upload MYSQL database. I don't have any idea how to upload it. It is my first time to do it. I already upload the pages from my local pc to server...
0
ammoos
by: ammoos | last post by:
hiiii friends...i want to upload some selected mysql datarecords from my offline system which is written in vb to online system which is made by asp.net with vb. i also want to make some processing...
6
by: fpcreator2000 | last post by:
Hello everyone. I'm having problems with a page I've created that is used to insert data into a database. It uploads two files into two distinct folder, and it takes the filenames and inserts...
1
by: updesigns | last post by:
I am currently using a php form to update data into a mysql database. Am unsure how to use a php script to upload a file and copy the url link into the mysql database
1
xxoulmate
by: xxoulmate | last post by:
how to upload a database on the mysql server., i am using mysql version 4.0.1 that database is not yet existing in the server. and that database in a format of file.sql(came from a mysqldump)
0
by: ahmurad | last post by:
Dear Brothers, I want to upload XLS/CSV huge data (90,000 rows in a XLS/CSV file) into MYSQL database. I want to use only Import option of phpmyadmin to upload XLS/CSV files. How can i to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.