How can i change the 'system_time_zone' variable in mysql server to "UTC+8" in my host machine(windows10 system) - mysql

the version of mysql server is 8.0.11 and the host machine's operate system is windows10 .I have read the mysql references in https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html. And it said that I can set the TZ environment variable to change the system_time_zone variable in mysql server.But after I set the TZ environment variable to "UTC+8" and restart the mysql server.The 'system_time_zone' is 'UTC',which I want it to be 'UTC+8'.How can I make it right?Thank you very much!

Related

MySQL value for 'secure_file_priv'

I have established a connection from JawsDB to MySQL Workbench and having an issue I think is linked to the secure_file_priv system variable. When working in my localhost, the value for the secure_file_priv is C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\. However, for the JawsDB connection, the value for that variable is /secure_file_priv_dir/.
Does anyone know how the /secure_file_priv_dir/ value works? Or, how I can get it to allow a LOAD_FILE process?

Howto activate named time zones

I want to automate the installation and configuration of a mysql server using azure cli.
The installation works well using azure mysql server create, however the configuration using azure mysql server configuration set -n time_zone --value Europe/Paris fails due to the following error:
Deployment failed. Correlation ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. The value 'Europe/Paris' for configuration 'time_zone' is not valid. The allowed values are '[+|-][0]{0,1}[0-9]:[0-5][0-9]|[+|-][1][0-2]:[0-5][0-9]|SYSTEM'.
As I read in the mysql docs I could enable named time zones executing the following sql SET GLOBAL time_zone = timezone;, but unfortunately my user would need super privilege for this to succeed and this is impossible in azure.
The other approach would be to run mysql_tzinfo_to_sql but this is not available using azure cli.
Is there any other way to activate named time zones?
From the Azure DB for MySQL documentation:
Populating the time zone tables
The time zone tables on your server can be populated by calling the mysql.az_load_timezone stored procedure from a tool like the MySQL command line or MySQL Workbench.
CALL mysql.az_load_timezone();
Also, in this doc (you linked to in your question):
Upon initial deployment, an Azure for MySQL server includes systems tables for time zone information, but these tables are not populated. The time zone tables can be populated by calling the mysql.az_load_timezone stored procedure from a tool like the MySQL command line or MySQL Workbench.
According to Error message the format should be one of these three:
[+|-][0]{0,1}[0-9]:[0-5][0-9]
eg. -04:30
or
[+|-][1][0-2]:[0-5][0-9]
e.g -12:00
or
SYSTEM
So have you tried doing it with quotes?
azure mysql server configuration set -n time_zone --value
"Europe/Paris"
CALL mysql.az_load_timezone();
Call this stored procedure from your session on the server,
If you are running the mysql.az_load_timezone command from MySQL Workbench, you may need to turn off safe update mode first using SET SQL_SAFE_UPDATES=0 or in Preferences->SQL Editor->Safe Updates(), and back to connect to your mysql server.

The server time zone value 'KST' is unrecognized: How to fix server-side?

I am running a MySQL client utility, and getting this well-known error:
The server time zone value 'KST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
Out-of-the-box Ubuntu 2019.04 with the database engine installed from the official Ubuntu repository (mysql Ver 14.14 Distrib 5.7.26).
How to fix it?
Appending &serverTimezone=UTC to the JDBC URL would fix the problem but unfortunately I can not control the URL used by the utility so I have to work around the problem server-side.
I tried running SET time_zone = "+09:00"; on the MySQL server, it does not fix the problem.
This might be part of the problem:
select * from mysql.time_zone_name;
Empty set (0.00 sec)
env | grep KST returns nothing.
If by KST you mean Korea Standard Time as used in South Korea, use the TZDB identifier Asia/Seoul.
SET GLOBAL time_zone = 'Asia/Seoul';
KST isn't a valid TZDB identifier.

MACOS / MySQL / SQL Developer connection error - timezone issue

On my Mac PC, I have installed MySQL and SQL Developer as well as the MySQL Connector/J, the official JDBC driver for MySQL, so that the MySQL tab appears in the connection window of SQL Developer.
In the SQL Developer connection window, I am filling in the following details
Connection name: test
Username : root
Password: xxxxx
In the MySql tab within this connection window, the hostname and port is auto populates the values localhost and 3306.
There is a button called 'Choose Database', when I click on this button I am getting the below error message in red color
"Status : Failure - The server time zone value 'AEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specific time zone value if you want to utilize time zone support"
How do I fix this issue so that I can connect to the MySql database from SQL developer?
PS: I am currently based in Sydney, Australia.
The problem got resolved by adding the below entries in the below mentioned file. In the new mysql database installations, this file would not be present so create the file so you will have create new plain text file with root privileges. When you start the MySQL server, this file will be read every time. The value specified below is a global parameter.
/etc/my.cnf
[mysqld]
default-time-zone='+10:00'
The single quotes should typed in not copy pasted.
And then restart the MySQL server.
Upvote to Nitin Puthran's answer.
If you have a Homebrew installation of mysql, my.cnf is in the Cellar mySql directory (not etc). For my version this is:
/usr/local/Cellar/mysql#5.6/5.6.41/my.cnf
[mysqld]
default-time-zone='+10:00'
And restart the mySql server.
I installed MySQL 8 with native packages on Mojave (10.14.6). As far as I can tell, there is no such thing as a my.cnf file. I couldn't get MySQL to recognize any my.cnf file, even by specifying one on the configuration tab of the MySQL settings applet in System Preferences. The only thing that worked for me was editing /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist and adding <string>--default-time-zone=America/Denver</string> to the Program Arguments section. Either restart your Mac or use the aforementioned applet to restart the server.
I imagine using a city name will only work if you have loaded timezone data into MySQL. mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql worked for me. Otherwise an offset like the above answers should work.

Change mysql system variable without restart

Is there any way to change value of "skip_name_resolve" variable on windows mysql server without restarting service?
This variable is not dynamic, and cannot be changed with SET query:
mysql> set global skip_name_resolve="ON";
ERROR 1238 (HY000): Variable 'skip_name_resolve' is a read only variable
The MySQL server maintains many system variables that indicate how it
is configured. Section 5.1.4, “Server System Variables”, describes the
meaning of these variables. Each system variable has a default value.
System variables can be set at server startup using options on the
command line or in an option file. Most of them can be changed
dynamically while the server is running by means of the SET statement,
which enables you to modify operation of the server without having to
stop and restart it. You can refer to system variable values in
expressions.
this is taken from http://dev.mysql.com/doc/refman/5.0/en/using-system-variables.html
ideally you should be able to change a variable by just using SET query.