MySQL can't connect - ERROR 2002 (HY000). Please HELP! - mysql

I was using mysql, trying to add some foreign keys to a database on a Debian server... and all of a sudden I started getting this message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
No matter what I do, I get this message. If I restart mysql, it just spits this crap out a bunch of times.
I have rebooted the server a bunch of times, and it's not going away. I have no idea what I did... I was just changing the schema of a database that has actually been in production for over a year.
I recently changed the domain name of this server, but mysql was working for a few days after this change.
Beyond that, I can't think of anything I did differently.
Please help. I have to get this database back online.
EDIT: Joy, mysql corrupted my actual database by trying to add foreign keys into a freaking database. The database is toast.
Good thing I have backups, but this is unreal.

This seems to be a useful link. It suggests starting mysql daemon, then type mysql.
/etc/init.d/mysqld start
mysql
If that does not work check the config files for both your mysql client and server to make sure they are pointing to the correct locations.

It turns out that the database was corrupted. If you're also getting an error like this that defies reason, try showing tables and selecting data out of your basic default databases that comes with mysql just to be sure.
In my case, dropping and adding foreign keys actually destroyed my database, which explains why rebooting the server or restarting mysqld was having no effect.

Related

Can't export MySQL database with PHPMyAdmin

I have a MySQL 5.5 database in a web hosting, which I access using PHPMyAdmin (the hosting provider doesn't give me shell access). I back the database up using the "Export" function in PHPMyAdmin.
Recently, however, whenever I try to run the backup, I get an interrupted DB dump, and I see in it a PHPMyAdmin backtrace saying that "MySQL: the server has gone away". The two solutions to this, as I understand it, are:
Changing the "max_allowed_packet" parameter in the server... but I can't do that.
Repair tables... but I checked the status of the tables in the DB, including the ones where the dump usually stops, and they all seem OK.
I can always back it up in chunks, but it's a hassle to do that when the DB has about 40 tables. What can I do to fix this?

If I reinstall MySql Workbech will i lose my data bases and saved connections?

When I start Workbench it pops up a message saying
Error while loading images: An error occurred while loading image search_sidebar.png.
Then I can't connect with my databases. I searched in MySQL forums and apparently that is a bug without resolving yet, and the only thing to do is reinstalling the program.
So, my question is simple: reinstalling workbench will make me lose my databases and connections? Im principally worried about de DB's.
Thanks for the help.
Mysql workbench is a standalone software. It won't affect your MySQL databases. It's same as removing phpMyAdmin from your server won't affect your databases.

Using MySQL workbench I can't create new connections

I have a freshly installed workbench 6.3 version and a 5.1 mysql Server version.
I already have connections created. Namely, I can successfully connecto to local Instance MySQL56, which I assume is a default connection. I have two, way older connections that have appeared even though last time I used this program (and later uninstalled) was months ago, with another version.
I've read what I've found and felt could help
MySQL Workbench 5.2 CE, Windows 7, "Can't connect to MySQL Server on 127.0.0.1 (10061)"
MySQL Workbench: "Can't connect to MySQL server on 127.0.0.1' (10061)" error
And tried every option. Nothing works. I try to create a connection with this steps:
Database -> manage connections -> bottom left corner: New
Then I give it a name, leave everything as default, put a pw into the vault, and try to test it. Does not work. Whatever combination I try, it does not work. Yes server is running, I've tried 3 different ways of checking.
I do not understand at all how something I've done in the past is taking me so many hours, I do not know what I'm missing, but I can't create a new connection.
Also to be noted, in case it's useful: On default schema, I write the name of a schema I previously created. Thing is, as I said, I've tried every combination. But when I've tried to save said schema in a folder, workbench has instantly crashed. Twice already.
I'm all out of ideas, so if anyone can tell me what to do, it'd be of great help, I find nothing following guides out there.

Connecting my MySQL databases to phpMyAdmin

I am running Mac OS 10.10.2. I have recently been educating myself about php and SQL in order to create an online database application for my employer. However, I have been unable to load up my MySQL databases in phpMyAdmin. I have tried following some advice from this forum, but no answers seem to solve my issue.
I installed MySQLWorkbench (Ver. 6.2.4.12437) as well as XAMPP (Ver. 5.6.3-0), and was using phpMyAdmin to have a play around and better understand what I was getting myself into. I then found one of those follow-the-bouncing-ball type teaching websites which advised me to download and install the MySQL community server (Currently running Ver. 5.6.23)
As instructed, I was learning SQL commands through Terminal and built up some databases/tables this way. I decided I wanted to jump into phpMyAdmin where I felt it'd be easier to continue my work. At first XAMPP was unable to turn on the servers which I overcame by uninstalling and reinstalling. Then I was getting a #2002 error when trying to access phpMyAdmin. I tinkered with config files and put in details relating to my localhost MySQL server (Or at least I assume as much).
I was able to get back into phpMyAdmin finally, but my databases made through terminal are not there.
phpMyAdmin shows: cdcol (the example database), information_schema, mysql, performance_schema, phpmyadmin, and test.
If I open terminal and punch in 'mysql' then 'SHOW DATABASES;' it only lists: information_schema.
If I open terminal and punch in 'mysql' with username 'root' and my password, then 'SHOW DATABASES;' it lists: information_schema, mysql, performance_schema, my tutorial/learning database, and my business database. I dropped the test database from here. THESE are what I want to bring up in phpMyAdmin.
I can only guess that I haven't got it configured properly to access this last mysql server, but I can't determine where I am going wrong. If anyone can shed some light on this, that'd be greatly appreciated.
It appears as if you have two MySQL instances; one from the XAMPP and also the MySQL Community Server that you installed yourself.
The "M" of XAMPP is for MySQL, so yes usually it runs its own MySQL server instance. That's sort of the point of the packaged kit, so you don't have to worry about having any of your own applications installed. In theory it should be no problem to stop the XAMPP MySQL instance and instead use your other one, but may require tweaking some configuration files and is probably not supported. If you can make it work, I don't see a reason why it would be a problem, though.
My suggestion is to either use the complete XAMPP stack or roll your own installation rather than mix and match.

Could not get database metadata for mysql on osx

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