Phpstorm Mysql Servertimezone

  1. Phpstorm Mysql Server Time Zones
  2. Phpstorm Mysql Server Time Zone
  3. Phpstorm Mysql Server Time Zone Settings

Today, I came across an issue in work which meant I needed to access our Microsoft SQL Servers that provide a database back-end for some of our legacy applications. I thought that gaining access would be straight forward but it turns out accessing SQL Server from a Linux machine can be a bit tricky.

Here we can see that the MySQL time zone is set as “System”. Which means current MySQL time zone depends on the system time. By default, MySQL time zone will be set to the server’s time zone. If you are interested in changing MySQL Time zone you can edit /etc/my.cnf configuration file.

  1. It cannot be done only using php, you have to use javascript along with ittake a look at jquery, its a javascript framework you can build real time apps using.
  2. Here you'll find the complete list of timezones supported by PHP, which are meant to be used with e.g. The behavior of timezones not listed here is undefined. Note: The latest version of the timezone database can be installed via PECL's » timezonedb. Note: This list is.
  3. The MySQL server when started picks up the timezone from the OS, and reports this in systemtimezone. However, if later the timezone changes MySQL keeps reporting the same timezone even though the underlying OS (Linux in my case) now reports a different timezone.

I wanted to use PHPStorm as the database client. I use PHPStorm as my main IDE and connect to all of our MySQL servers using it so it seemed like a logical choice.

I spoke to my colleagues who unfortunately both use Mac's. For them, access was reasonably straight forward as they could use Microsoft's SQL Server Management Studio client which handled most of the heavy lifting. Unfortunately this software is not available on Linux so I have been forced to get creative.

If you have a similar setup, and need to access SQL Server from a Linux machine, these instructions should get you up and running.

In PHPStorm, create a new SQL Server database connection. To do this, go to the View -> Tool Windows -> Database window. In the top left of the database window, you should see a small plus icon to add a database connection. Click it and go to the Data Source -> SQL Server options.

Evernote link to other notes. A new window will appear allowing you to set up your new SQL Server connection. Populate the following fields:

  • Host
  • Port (usually defaults to 1433 for SQL Server)
  • User (this should be your LDAP username you use to authenticate. Ensure that you do not include the domain)
  • Password

Install the SQL Server (jTds) Driver

Phpstorm Mysql ServertimezonePhpstorm Mysql Servertimezone

I unfortunately couldn't connect with the driver SQL Server (Microsoft) that you are prompted to install by default. No worries though. On the left-hand side, you should see a list of Drivers. Scroll down until you find one called SQL Server (jTds) and click it. You will then be presented with the options for this driver.

If you don't have this driver already installed, you will need to download it. Luckily you can do this in PHPStorm. In the driver files section, there will be a link prompting you to download the latest driver if you don't already have it installed. Click this to get the driver on your system.

Select the SQL Server (jTds) Driver

Once you have confirmed your driver is installed, scroll back up the left-hand side list until you find your SQL Server connection. Once selected, we need to change the driver from the Microsoft version to the jTds version.

This is done by clicking the driver name and selecting the one we want from the drop down menu that appears. The driver name is highlighted in the screenshot below:

Configure Our Driver

Finally we need to configure our driver. Select the Advanced tab.

Phpstorm Mysql Server Time Zones

You will be presented with a list of key value pairs. You need to set the following options:

  • DOMAIN - This should be the active directory/LDAP domain your username is listed under.
  • USENTLMV2 - I had to set this to true but you might not have to. It will depend on the authentication settings used by your network.

Phpstorm Mysql Server Time Zone

That should be all there is to it. Click on the test connection and if all details have been entered correctly, you should receive notification of a successful test.

Phpstorm Mysql Server Time Zone Settings

Photo by Caspar Camille Rubin on Unsplash