Mysql TIMEANDDATE changing when importing table to server - mysql

somwthing super weird is happening hope you can help me. I have a local mysql running and my data for example is like this:
Product - Price - Time
Microphone - 10 - 2021-06-14 08:44:17
Time is the time this information was parsed from the website.
So now I dump this table with the command:
mysqldump -u root -p Mydatabase Mytable > C:\Users\Me\Desktop\Mytable.sql
After that I export this to the server (bluehost) with:
mysql -h -u -p < C:\Users\Me\Desktop\Mytable.sql
The weird thing is that the time and date when uploading to server automatically changes to something else and does not stay the same as in the original data collected in the local mysql !!!
Do you understand what is potentially happening?
Thanks

Problem solved, yes that was a server issue. At bluehost I had to find .htaccess file and add the line "php_value date.timezone "America/Denver." under the

Related

MySQL importing issue

I have MySQL server (version - 5.6.35),lot of database are running here and every day am taking full backup using script,
mysqldump --force --opt --user=$USER --password=$PASSWORD --single-transaction --databases $db > $OUTPUT/date +%Y%m%d.$db.sq
backup is done correctly and its size also seems correct only , but when am trying to restore a single DB nothing is happen . nothing is importing and not getting any error , same time some database can import correctly .
Any one can suggest what is issue and how to resolve .
Here's how you bring it back:
Go into MySQL and do CREATE DATABASE databasename ; You should give it the same name it had before it was backed up.
At a MySQL prompt type source /path/to/OUTPUTdate2017Oct13.db.sq ;
I have only done it from within Linux and do the backup in a similar way to you. Not sure if it works the same from Windows, good luck..

Database missing error

In my xampp,i could not start the MYSQL section.So XAMP re installed.Before reinstallation i keep database backup from the path C:\xampp\mysql\data.
After reinstallation paste datafolder content into this path.Then I tried to accessing phpmyadmin,then database and table names are listed there.But there is no content into each table.While clicking the database table, it shows an error table does not exist.Please give any solution for my this issue.Thanks in advance
Well, dumping DBs is pretty easy. I assume you are on localhost and your user name is root.
Make sure your MySQL server is up and running.
Run Command line and for dumping ALL your DBs, type:
mysqldump -u root -p --all-databases > dump.sql
Hit Enter. The system will ask you for a MySQL password, type it and hit enter. If there's no password set for your server, just hit Enter. Your dump file will be saved in the current directory.
To restore the dump (e.g. after you reinstalled MySQL), run Command line again and make sure you are in the same directory where your dump.sql is. Type:
mysql -u root -p < dump.sql
It will ask you for a password. You know what to do. Depending on how many data you have it can take some prolonged time. Hope it will help!
P.S. Dumping/restoring single DB is a little bit different, let me know if you need it and I will update this post.

Mysql command returns no errors and doesn't import the sql file. Why?

I'm executing on a Centos Linux server this command:
mysql -u root -p mydatabase < dump.sql
I enter the password. It seems that all is ok because I absolutely get no errors, no messages that something happened. But sadly, the file is not imported!
Tryed in different ways:
-Putting the sql file in another location.
-Creating the DB first and than without the DB.
-Avoiding the dbname
-Adding max_allowed_packet=800M in /etc/my.cnf (because the file is 490mb)
-Restarted Mysql. But nothing to do. No errors, no import. I'm stuck and in panic. What to do? ?
If you have already created database then use below steps to import data from .sql file
DataBase to use:
use DataBaseName;
Give the source file path
source /path/to/dump.sql;
Hope this will help

Uploading a huge SQL file

I have a 3 huge 5GB .sql files which I need to upload to my server so I can process it. Its too large to run on my computer so I can't process the information offline.
So the question, How can I upload a huge 5GB sql file to MySql server without using PHP because its upload limit is 2MB.
The MySql is hosted on a remote server miles away so I can't just plug it in but I have turned remote access on which should be of some help.
All ideas welcome.
Thank-you for your time
Paul
You cannot use PHP to import such huge files. You need to use command prompt to do so. If you have access to the server then it's quite easy to do so. You can login to the server through SecureCRT(paid) or putty(free).
Use this command to import the sql database to the server - Using IP Address
$ mysql -u username -p -h 202.54.1.10 databasename < data.sql
OR - Using hostname
$ mysql -u username -p -h mysql.hosting.com database-name < data.sql
If you wanna try it out locally first to get used to the command prompt. You can use this.
$ mysql -u username -p -h localhost data-base-name < data.sql
Are you using something like phpMyAdmin? If you have ftp/sftp access upload the file and then run it with phpMyAdmin.

Quickest way to transfer data from MySQL DB 1 to MySQl DB 2

I have a new database, similar to the old one but with more columns and tables. So the data on the old table is still useable and needs transferring.
The old database is on a different server to the new one. I want to transfer the data from one database to the other.
I have navicat, but it seems to take forever using the host to host data transfer. Also downloading a sql file then executing that takes too long also (it executes about 4 inserts per second).
The downloaded SQL file is about 40mb (with complete insert statements). The final one would probably be 60mb to 80mb.
What's the best way to transfer this data? (a process I will need to repeat a few times for testing)
Doing a mysqldump on the source machine and then slurping it in on the other side, even on a 40-100MB file is well within reason. Do it from the command line.
(source machine)
mysqldump -u user -p password database > database.sql
..transfer file to recipient machine...
(recipient machine)
mysql -u user -p password database < database.sql
Can you not transfer only a portion of the data for testing first? Then, later, transfer the entire thing when you're satisfied with test-results?
(it executes about 4 inserts per second)
That sounds more like there's something wrong with your database.. Are you sure that's alright?
Cody thank you for the direction. For some reason it did not work for me, but the below did on my redhat linux server:
(recipient machine)
mysql -u [username] -p -h localhost database < database.sql
(source machine)
I just used php myadmin
Is there a command that can be run to pull the DB from another server something along the lines of: mysqldump -u [username] -p -h [host address] [dbname] > [filename].sql
Thanks