Could not get database metadata for mysql on osx - mysql

I have a mysql database with 3000 tables, and a hibernate application. It working fine on ubuntu, but on Mac(homebrew) always show connection errors after
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
I doubt some setting for mysql need to be change, but do not know which one.

Looks like your database server isn't responding.
Check the configuration files for hibernate and make sure that it's pointed at the right host for the database.
If you're using localhost, make sure that the mysql server you're running locally is up (ps or mysql command should help here) and verify that hibernate is either communicating over the UNIX socket, or that you have networking turned on in your local server (since by default it's usually off and required for TCP/IP access, even to localhost).

Fixed after added 'max_allowed_packet=20M' to my.cnf

Related

MySQL - change connection to MysqlWorkBeanch

I have a server at Amazon with my Database and I usually acess by hpMyadmin with no problem, but I hate that. I downloaded the MYSQL WorkBench but I can't connet to my server, anyway. I am always receiving the same message as follow:
Connecting to MySQL server ... Can't connect to MySQL server on (10061)
Someone, did have the same problem or known how to do?
Thank you.
Most providers allow access to database only from they local network. Databases aren't visible from the internet. The reason - security.
Server with phpMyAdmin is located in their internal network so it have no problem with accessing to database, but your computer is on the outside and DB isn't visible for it, hence the connection error.
If you have ssh(or vpn) access to machine (but you probably don't) you can create tunnel and access your DB through it with workbench.
On the other hand, you should be able to upload your own web client, different than phpMyAdmin e.g http://mywebsql.net/

MySQL Workbench works and phpmyadmin does not

About 2-3 weeks ago I stopped using phpmyadmin and started using MySQL Workbench. Now, I can't connect to phpmyadmin. I tried connecting from two different computers and from the server. Tried connecting with at least 4 users and root. I am suspecting that this is Workbench's fault. During the time I used Workbench I made some changes to user privileges, but don't remember the specifics. I get "Wrong username/password".
Any thoughts ?
Looks like some of the comments have been deleted, but judging by what's left there was a suggestion for you to check your permissions for your user with hostname localhost, and it appears you did not understand that % is not the same as localhost. Many installations come with several root users, one for host localhost, one for host %, and sometimes a third for 127.0.0.1. This is normal and part of how MySQL handles permissions. TCP/IP connections match %, socket connections do not (they use localhost).
Another thing that's important to realize is that, when using phpMyAdmin, it doesn't matter what client machine you're using; what matters is what machine is the web server, since that's where the requests to MySQL come from. So you can easily get a bit confused if using a remote machine to connect to a web server running on the same machine via sockets to the MySQL server -- even though you're on a remote machine from the MySQL server, in this case it appears as a localhost connection to MySQL.
Anyway, very likely what happened was you were "cleaning up" extra users and removed one that had the opposite host value (either % or localhost); I'd simply recreate your user with the other host. That should clear it up for you.

How to keep multiple instances of MySQL

I have installed xampp for Linux. It's working fine and my mysql is also working fine.
I have another application that also uses mysql but i need to stop mysql server if i run Xampp. However, Stopping mysql server this way halts the other application and it throws the following error:
⇝ OperationalError: (OperationalError) (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") None None
How can I stop this error and keep both applications running on same Mysql server. Both use a single mysql server instance, but I need to halt one in order to run another.
Can any one help me resolving this issue. Any help will be appreciated.
I think you need more mysql servers, may be four or five (just kidding).
First, two applications can work with the same server using different database/username => you don't need two mysql servers. If you need, you are wrong step before.
Second, you'd probably better to use native apps for you linux distro (ie mysql/apache/whatever-comes-with-xampp). If for whatever reason you have to stick up with xampp (what I believe is not true), don't use native mysql/apache/etc.

MySQL remote connection slow even after enabling skip-name-resolve

I have a development environment set up with remote access to a shared dev database.
I'm experiencing VERY slow response time from the remote MySQL server. I've added skip-name-resolve to the my.cnf file, restarted mysqld, and also verified that it is indeed, turned on via 'show variables' at the mysql command line.
Interestingly, if I connect to the command line interface remotely via
mysql -h IPADDRESS -u USERNAME -p
All commands are executed lightning fast.
Select * on a large table comes down the pipe instantaneously.
I'm wondering why the CLI would allow immediate response, but the php connection in my application waits 8-10 seconds before returning any data from the remote MySQL server. It's an Amazon EC2 instance, and it's the Amazon linux ami, seems to be similar to CentOS. Any ideas?
Thanks!
I've just solved same problem I was having, took me 4 days.
Apache was ok
MySQL was ok too
Problem was in my script - gethostbyaddr();
when accessing web server on the localhost is fine.
But when accessing the server from another computer takes ages, so for now I have commented out gethostbyaddr() and it is fast as if run from localhost.
I am guessing gethostbyaddr() is some sort of Windows DNS issue which I'll look into later
I'd start by determining where the slowness comes from. Is it in establishing the connection when you open the db, or is it in returning the results from the select, or both? You don't say what version of PHP you're using or what version MySQL is running on the server. My money would be on that specific combination being problematic. Make sure you're running the latest updates on your AMI.

Create datasource for mysql to different machine in glassfish

I'm using glassfish(v2.11) as my application server and I have another machine for mysql database server. Currently I want to separate the app server and db server, so I create a jdbc datasource to point to mysql server, but it doesn't works as expect, by the way, when I create datasource to point to local machine (glassfish app server and mysql db server in single machine), and It works well.
Is there any configuration I need to care of when pointing datasource to different machine which I use to host my database (MySQL 5.1)?
Besides granting the mysql user you'll connect as the proper rights, specifying the host in the JDBC url, and making sure there's no firewall stopping you (default mysql uses port 3306), there should be no difference.
WOW ...restart glashfish app server and it works .. :)