I am using hibernate (Hibernate Maven 5.2.15.Final, Mysql-connector Maven 8.0.9-rc) whith mysql 5.7 on lampp environment on linux so.
I am in Italy (Central European Summer Time) and once March 25, occurs follow error on connection db:
The server time zone value 'CEST' 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.
On mysql console, I ran:
SHOW GLOBAL VARIABLES LIKE 'time_zone';
SET GLOBAL time_zone='Europe/Rome';
but that did not persist.
Then I added to my.cnf file (in /etc/mysql):
[mysqld]
default-time-zone = 'Europe/Rome'
and also:
default_time_zone = 'Europe/Rome'
but the db server did not start still...
Why does the error occur?
Could someone help me?
Thank you!
#aiman's answer is not correct since in your case the effective server timezone is not UTC.
You'll find on the net some solutions including additional parameters on the jdbc connection string, but there are cases where you cannot change this string.
Here's how I fixed it:
First import the system timezones in mysql:
$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Then set your default mysql server timezone in the [mysqld] section of /etc/mysql/my.cnf (or of /etc/mysql/mysql.conf.d/mysqld.cnf on recent Debian/Ubuntu distros) to your actual server timezone, for instance:
default_time_zone = Europe/Paris
and don't forget to restart mysql
$ sudo service mysql restart
(or the appropriate command depending on your distro).
If the problem is when connecting to the db, I found the solution in the NOTE of this answer.
In your connection url use the following:
String url = "jdbc:mysql://localhost/mydb?serverTimezone=Europe/Rome";
This worked for me to connect with flyway and timezone Europe/Amsterdam.
First see your mysql server timezone:
mysql -e "SELECT ##global.time_zone;" -u <mysqluser> -p.
Most probably it should be SYSTEM.
Find your system timezone: date +”%Z.
See if its CEST.
You need to change your system timezone:
#cd /usr/share/zoneinfo
#ls -l
#rm /etc/localtime
#ln -s /usr/share/zoneinfo/UTC /etc/localtime
Then restart your mysql server: /etc/init.d/mysqld restart.
Enjoy
This cropped up out of the blue on my dev machine - restarting MySQL fixed for me
I am trying to restart flanneld service running on one VM from my zabbix server UI using triggers and action. I followed the zabbix-docs. zabbix user has sudo permissions ( verified this by logging as zabbix user and running command sudo yum update ). Command used to start flanneld is sudo /usr/bin/flanneld. Does anyone know the cause ?
Configuration done :
Action is created on trigger "flanneld service not running" as-
Conditions :-
Trigger = my Zabbix server: flanneld service not running
Host = my Zabbix server
Operations :-
Target list : Host: my Zabbix server
Execute on Zabbix agent
Commands : sudo /usr/bin/flanneld
thanks in advance.
I would firstly append sudo within your script to the relevant sections so you do not need to worry about that and simply add the location to your script within Zabbix.
You will then need to ensure that you have enabled "EnableRemoteCommands" as by default running a remote command is disabled on a Zabbix agent.
You can do this by simply adding the following line in your zabbix_agent.conf file.
EnableRemoteCommands=1
Pretty simple question here. I just want a SQL database on my version of Kali linux so I can practice SQL.
I opened the command line and entered tried to start mysql and get an error.
> mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
I also made sure it was already installed using apt-get.
What are the steps I need to take to be able to make a database with tables and data that I can query?
I don't know about Kali, but on Ubuntu it would be
$ sudo service mysql start
Once that command returns, the mysqld service has started, so you can use the mysql client to connect to it.
Of course, you also have to make sure you have the mysql-server package installed, not just mysql-client and mysql-common, and that you've initialized the database instance. Complete post-installation instructions can be found in the official documentation, but the short version is
Make sure the installer has created the mysql user account. This is the account that will "own" the server process once it starts.
Change to your data directory. (I used the installer's default of /var/lib/mysql; you can change this by editing my.cnf.)
As root, execute the server daemon with the --initialize switch. Check whereis to determine the correct path, then
$ sudo /path/to/mysqld --initialize --user=mysql
This command will twiddle itself for a while, then display an automatically-generated password and exit. Once the command returns, the database instance has been initialized and the system tables created. You can now start the database instance normally (using service start), then log in as the database user root (which is not the same as the system user root) using the password from above, then change your password, create a new database user, log in as that user, create a user database, and start creating tables.
Again, the official documentation is the place to look for this; if any of the instructions in the official documentation differ from my instructions, you should ignore me and follow the official documentation's instructions.
If sudo service mysql start doesn't work for you, please try running mysqld_safe and don't kill the process. Use another tab to check the status of mysql service. This should solve your mysqld.sock issue.
If it doesn't work out, then please edit your my.cnf file and add the following:
socket=/var/lib/mysql/mysql.sock
And the permissions,
sudo chmod -R 755 /var/lib/mysql/
Hopefully, this should do it.
On my version of kali (2022-rolling), even though it's installed as MySQL, it's run as mariadb. To start it is:
sudo /etc/init.d/mariadb start
Try this
sudo service mysql start
First, I will write that why I want to do it.
When I run a Ruby on Rails' database rake comamnd, it showed:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I created that file:
touch /tmp/mysql.sock
and run the command again. I showed:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)
I have search it by Google, most of them said that should check mysql's status.
I am using FreeBSD 9.1 now. From this article there is a good method to do that:
http://www.cyberciti.biz/faq/freebsd-start-stop-restart-mysql-server/
But unlucky, I can't find mysql-server in my /usr/local/etc/rc.d/ directory.
I want to know where my mysql is, so I run:
whereis mysql
It showed me this only:
mysql: /usr/local/bin/mysql
But when I try:
/usr/local/bin/mysql status
It showed:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)
In other way, if I try to connect my mysql using this command:
mysql -utom -p1234 -h my_mysql_host_name
I can connect my local database.
I don't know the reason about /tmp/mysql.sock. It seems a bad issue.
Status:
# service mysql-server status
mysql is running as pid 45699.
# ps 45699
PID TT STAT TIME COMMAND
45699 ?? I 0:00.50 [mysqld]
Did you follow the MySQL installation instructions & ensure GNUMake was installed on the system prior to installing mysql? It sounds like your installation is only half there ... if at all.
You should have a startup script in /usr/local/etc/rc.d/mysql-server -- it's absence is a clue that the install isn't correct.
Lastly, you can't just "create" a socket in /tmp (.."touch /tmp...) and expect it to work. It's not there for a reason... Likely because your install isn't complete.
Once you have things installed right, you should be able to get the status by typing
https://dev.mysql.com/doc/refman/5.1/en/freebsd-installation.html
Type service mysql-server status
If you appears that mysql is not running.
Check file etc/rc.conf check your line mysql_enable="YES" If you have added manually.
After the service mysql-server start
If not working even now, do the following steps:
-Type service mysql-server stop
-go on var/db and delete mysql folder
-go on /tmp and delete mysql.sock
-type in console service mysql-server start
-Now check if mysql is running process.service mysql-server status
If it works now create an user :
mysql -u root
GRANT ALL PRIVILEGES ON *.* TO root#"%"
IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
BIG EDIT :
If you have not installed mysql:
Upgrade the ports: portsnap fetch extract
Move on mysq dir: cd /usr/ports/databases/mysql56-server
Make install: make install clean
Another EDIT :
If you want to decrease the time, you can use pkg. which takes about 5 minutes to install mysql with him.
With pkg : pkg install mysql56-server and it's done select Y to confirm install and wait . Now configure rc.conf and set mysql user , done
Cannot connect to MySQL Workbench on mac. I get the following error: Could not connect, server may not be running. Can't connect to MySQL server on '127.0.0.1' (61)
The help would be appreciated.
Thank You!
Ran into a similar issue and my problem was that MySQL installed itself configured to run on non-default port. I do not know the reason for that, but to find out which port MySQL is running on, run the following in MySql client:
SHOW GLOBAL VARIABLES LIKE 'PORT';
Go to System preferences -> MySql and check the state of your MySql instance.
There may be one or multiple reasons if you are not able to connect to MAC OS X MySQL server with MySQL-workbench.
When you press 'test connection' you might see this error. This could be explained briefly if you go step by step through 'Configure server management..'
On the basis of the red crosses you can filter out the real problem.
The most common problems are associated with the installation of MySQL-server. Few people either forget to install the server prior to installing MySQL-workbench. Some others would install a part of the product. Please check whether you have also installed all the 3 parts that comes with the MySQL-Server dmg(disk image) file which contains mysql-server package. Those 3 parts are: MySQL server, preference pane and startup item.
Note: If you haven't selected preference pane then you won't be able to start mysql server instance from the System preferences.
After you make sure that you have installed each item then you can check server instance of your native mysql-server. Open System preferences from dock and click MySQL. Then click Start MySQL Server to start the server instance. If the server instance is stopped, then MySQL-workbench won't be able to connect to the MySQL server.
If you are still facing issue, then you need to check the port of the connection which you are making. Default port is '3307' and NOT '3306'. You can check it with using the following command in mysql terminal:
SHOW GLOBAL VARIABLES LIKE 'PORT';
Please note that this process helps you to connect to the local instance. If you have to connect to a remote server, then you have to enter that specific IP and Port. Contact your server's administrator if you are facing the issue. As this question specifically states that the problem is related to connecting to the local instance, I am not writing checks that you may need to ensure.
This steps are all in the terminal:)->source
Step make sure your server is running:
sudo /usr/local/mysql/support-files/mysql.server start
Check MySQL version. "This also puts you in to a shell interactive dialogue with mySQL, type q to exit."
/usr/local/mysql/bin/mysql -v
Make your life easier: "After installation, in order to use mysql commands without typing the full path to the commands you need to add the mysql directory to your shell path, (optional step) this is done in your “.bash_profile” file in your home directory, if you don’t have that file just create it using vi or nano:"
cd ; nano .bash_profile
paste in and save:
export PATH="/usr/local/mysql/bin:$PATH"
"The first command brings you to your home directory and opens the .bash_profile file or creates a new one if it doesn’t exist, then add in the line above which adds the mysql binary path to commands that you can run. Exit the file with type “control + x” and when prompted save the change by typing “y”. Last thing to do here is to reload the shell for the above to work straight away."
source ~/.bash_profile
mysql -v
"You will get the version number again, just type “q” to exit."
Check out on which port the server is running:
in your terminal type in: mysql
and then
SHOW GLOBAL VARIABLES LIKE 'PORT';
use everytime a semikolon in the mysql client (shell)!
now you know your port and where you can configure your server(in the terminal with mysql shell/client). but for a successful connection with MySQL Benchmark or an other client you have to know more. username, passwort hostname and port. after the installation the root user has no passwort so set(howtoSetPW) the passwort in terminal with mysql shell/client. and the server is running local. so type in root, yourPW, localhost and 3007. have fun!
Try restarting the mysql or starting it if it wasn't started already. Type this within terminal.
mysql.server restart
To auto start go to the following link below:
How to auto-load MySQL on startup on OS X Yosemite / El Capitan
In my case I had a previous mySQL server installation (with non-standard port), and I re-installed to a different directory & port. Then I got the same issue (in windows). To resolve, you click on home + add new connection.
If you need to know the port of your server, you can find it when you start My SQL command line client and run command status (as below). In windows it is via All Programs -> MySQL -> MySQL ServerX.Y -> MySQL X.Y Command Line Client
I had the same issue, I solved this with the following steps:
Install the MySql (DMG) from this link
If the mysql package comes with the file name "mysql-5.7.13...." and
"MySql.prefPane" then your life is really easy.
Just click on "mysql-5.7.13...." and follow the instructions.
After the installation is done, click on "MySql.prefPane" and checkout "Only
for this user" in the popup. We use "MySql.prefPane" to start the mysql
server as this is really imp because without this you will end up having
errors.
Click on Start MySql Server in the next dialog box.
OR
If you don't see "MySql.prefPane" in the package then follow these steps:
Click on package "mysql-5.7.13...." and this will show you one password as
soon as installation is done. That password is use to start the connection.
You can change it. I will let you know in a while.
After installation save the password (this is really important - you'll need it later), open terminal.
$ cd /usr/local/mysql/bin/
$ ./mysql -u root -h localhost -p
And then type the password from above. This should start mysql>
To change the password:
$ cd /usr/local/mysql/bin/
$ ./mysqladmin -u root -p password 'new_password'
Enter Password: <type new password here>
$ ./mysql -u root -h localhost -p
... and log in with the new password.
After this you can go to MySql workbench and test connection. It should connect.
brew services start mysql defualt set --bind-address=127.0.0.1 with /usr/local/Cellar/mysql/5.6.27/homebrew.mxcl.mysql.plist,so replace --bind-address=127.0.0.1 with --bind-address=* or --bind-address=0.0.0.0
for mac : check the compatible version of mysql server in workbench>preference>MySql
if it's the same version with your mysql server in: cd /usr/local/
I am using those commands on MacOs after getting the same error
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
I had the same problem. I removed mySQL completely, and reinstall it using homebrew.
I had same problem, but it worked for me.
check if you have mysql installed
If you don't have mysql installed, download from this link: https://dev.mysql.com/downloads/mysql/
follow this instructions to install
https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html
You can test the connection without any problem.
(Sorry for my english, I agree fix me please)
I Hope I've helped.
Greetings.
I ran into the same scenario
I opened "System Preferences", clicked "MySQL", then clicked "Initialize Database" button. I entered a new password and saved it in a safe place.
After that i restarted the MySql Instance (in the System Preferences dialog as well).
After that i opened MySqlWorkbench and opened the default connection, entered the password i set before and: Viola, i can do whatever i want :-)
I had this same issue on Monterey. Make sure you're selecting the correct download according to your processor architecture.
Community download processor architecture
Also, for the Connection Method use the Local Socket/Pipe
connection method
Dropping this to share my experience.
I had the same problem and realise I didn't start MySql server.
The steps below shows how I was able to login:
To start your server, Go to Preference and find MySql.
Click on the instance tab to start the server
Afterward, return back to Mysql Workbench to start the Local Instance and you'll be connected.
Have fun !
I had similar issues in Mac OS Catalina and the easiest way to solve it is by downloading HOMEBREW package manager for mac. Follow the steps to install HOMEBREW and mysql server.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install mysql
$ brew tap homebrew/services
$ brew services start mysql
mysqladmin -u root password 'yourpassword'
Now try using mySQLworkbench it should work.