How do I get time zone support for MySQL? - mysql

I've just begun attempting to use UTC on MySQL and it seems that my download did not include a timezone file and doesn't support it (it shows up as NULL).
I've looked around the MySQL website for a way to get timezone support loaded, but I can't seem to find anything.
Can someone walk me through the process or tell me whether there's a file I should import? I've already seen the manual pages, but it doesn't seem to apply to my situation.
Thanks!

What exactly are you trying to do?
The usual way would be to ignore timezone issues when you're storing things in the database. Put them in as timestamps, which will be timezone-agnostic (i.e., they'll be the time in UTC). When you want to display something in your application, you will need to retrieve the timestamp from the database and display it according to the appropriate timezone for the machine it's running on.

Related

Where to find mysql logs regarding user changes in phpmyadmin

I want to know, is there a log that saves all the changes made by users to a database just like in git where all the commits can be viewed by each user so that if any error occur we know who did it.If there is one how to get it? or how to create one that will do it?
Problem I'm facing is that a table's data has been altered by one of the developers but there is no way to find when and who did it and also I am struggling to find all the changes that has been done to the table.
Databases typically do not provide auditing as standard. I typically implement it within my application. However, for a faster result, there are some plugins for mySQL which you could try.

Export query from MySQL to Redshift

I need daily load the result of a specific query to Redshift. I've already created a table on redshift that will support the results of this query but now i'm a little stuck since i can't find a good way to solve this.
So far i tried using python but im getting lots of headaches regarding line terminators in fields that basically store a description, and character encodings.
I know lots of programs that allow you to connect to a db and make querys also have an export option to csv but since i need to automatically do this everyday i don't think any of those would work for me.
Now i would like to know if maybe there are better suited options so i can start looking into them. Im not asking for a step by step how to but just for tools/programs/etc that i should start looking into.
You should look into MySQL's stored procedures and events -- using just MySQL, you can have it generate a file every day.
You can't dynamically rename the file, or overwrite it, though, so you'd need a second job which deletes the file -- this can be done with Python.
Whether you're running Windows or Linux, you should be able to schedule a batch file or python script to execute once a day, and that would be an alternate way to do that.
Does this address your question?

Ways to log MySQL Diff?

I'm working on a project right now that required me to use a CMS that makes multiple changes to a database, I'll need those changes later in order to create a post install configuration file to reuse those changes. I know that there are lots of Windows based programs that will show you MySQL Diffs, but what about Linux? I would like the ability to keep an appending log of my changes so I know what exactly is going on under the hood.
The ideal scenario would be that I can capture a post and current state, compare them, and aggregate the output. Does anyone know a way to do this?
If these are the only changes made to your database then one way to do this is to enable the binary log, and use that as your change log. You can convert it to a SQL script using the mysqlbinlog tool.

Timezones for international web app in the zend framework

I have a web app which I want to work internationally.
I can ask each user their time zone and store it, no problem. Then I'm looking to store all dates in UTC and make the adjustments when transacting from the database.
Firstly, is this the best way to do it, or are there any other suggestions?
Secondly, does anybody know how best to convert the timezones when going to and from the database? Could I create some clever layer (in the zend framework) that does this automatically based on the php environment timezone, or would I need to update all of my queries?
Many thanks!
Zend_Date does all of this and much more .

Updated version of the mysql World database?

I know it's meant only as a test database, but I can;t find an (updated) copy of the World DB anywhere. The one on the Mysql site is out of date for most countries (presidents/heads of state have changed, etc). Anyone know where this data came from?
It does not seem like there is an updated version. The source is Statistics Finland, according to MySQL's setup page.