How to keep multiple instances of MySQL - 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.

Related

How to connect to a MySQL db via a client on Mac?

I'm used to MS SQL and Management Studio on Windows but got MacBook recently, and appereantly, I don't have enough RAM for the tasks I need to do on my Parallels Desktop.
Thus, I installed MySQL on my Mac and been able to create a database via MySQL Workbench.
I can see the database exists when I type in
SHOW DATABASES;
However, whenever I want to connect to the localhost server via a client (Sequel Pro), using the same connection informations as I used to Workbench, I get this error message:
MySQL said: Authentication plugin 'caching_sha2_password' cannot be
loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so,
0x0002): tried: '/usr/local/lib/plugin/caching_sha2_password.so' (no
such file)
Help would be appreciated.
Thanks!
I'd strongly suggest you to use Docker to run Databases locally instead of installing them.
This gives you lots of advantages (eg: only run it when you need it) and moreover there are plenty of documents around that tells you how to quickly run and connect to it.
For example --> https://dbschema.com/2020/03/31/how-to-run-mysql-in-docker/ (the real first result found duckduckgoing it :))

Unable to find or create new databases using Sequel Pro, but can using phpmyadmin

I am using MAMP Pro and I am having an issue where I cannot find existing databases on Sequel Pro, nor can I create new databases. However, on phpmyadmin, I can see and edit the existing databases and create new ones without any issue. I believe the issue lies with the mysql version on Sequel Pro.
As you can see, on the left, phpmyadmin is running on the MySql server version 5.6.35, as is MAMP Pro, which is in the center of the image. However, Sequel Pro, at the bottom of the image, is running on MySql server version 5.7.18.
I really appreciate any help that can be given, I am close to tearing my hair out!
Thank you!
Clearly the problem is that you're connecting to two different MySQL instances.
Unless you have a good reason to run two MySQL servers on your computer, you should consolidate the databases and remove one. That way you don't get confused when trying to connect. Perhaps you had MAMP installed and also installed another MySQL server; or vice versa. Be careful not to remove the datadir from the MySQL server you're using though, and take backups before you do anything. That's aside from the actual problem, anyway.
You can use the STATUS SQL command to see the connection information — it looks like Sequel Pro is connected via a socket, and STATUS will tell you the path to the socket. Run the command from phpMyAdmin as well to see how it's connecting (it's going to be socket or TCP/IP networking); you can the configure Sequel Pro to connect using the same connection settings phpMyAdmin is using. You could, if you really wanted to, run multiple MySQL instances alongside each other and configure your clients to connect to the proper one (phpMyAdmin at least allows connecting to multiple servers, I assume Sequel pro does as well). You'd use either a different socket or different network port numbers for each server instance — as well as a different datadir for each, since MySQL would not deal well with sharing the data between different versions of the server, especially if they're running concurrently.
To summarize, tell Sequel Pro to connect using the same settings phpMyAdmin is using.
EDIT:
You've determined that MAMP and phpMyAdmin are connecting via the socket /Applications/MAMP/tmp/mysql/mysql.sock — which means they're using the MySQL installed by MAMP (presumably you've installed another MySQL server independently of that). From the Sequel Pro "QUICK CONNECT" page, click over to the "Socket" tab and enter the correct socket like so:
I believe the "Name" field can be anything you prefer, although I don't really know this software program.
If you every use other software, try to remember that '127.0.0.1' and 'localhost' are two very different things to MySQL; the first one always implies using TCP/IP networking and the latter uses sockets (Sequel Pro seems to deal correctly with it so it's not relevant on this connection screen). You, of course, want 'localhost' since you're using sockets.

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

MySQL not connecting with PHP

I installed MySQL server and everything worked fine in command line. I worked connecting MySQL to my ASP.NET application and there is no problem at all. But when I try to connect MySQL to PHP applications I am unable to connect. When I installed PHPMyAdmin I am getting error #2002 Connot log in to thie MySQL server
I browsed all the night for this error and none of Google's results helped me! :(
Anybody can you please tell me where the problem is at? I believe I must change my PHP.ini file settings in order to connect to MySQL. Anybody please help me.
There are a lot of things that can cause this type of issue. Did you make sure that you have added php-mysql drivers to your sever. Since you said your using ASP i will assume that you are using windows servers. Make sure that you also are allowing that user to connect via localhost or what ever ip the PHP is on.
In php there are to standered ways of connecting to a MySQL database.
php-mysql(is going to be depercated soon).
php-mysqli(OOP version of the php-mysql with lots of features).
With out one of these php will be unable to work with a MySQL database. I am not sure if phpmyadmin works with both drivers or just one of them It could be throwing a die("message") Just to let you know it is not working instead of throwing a more complex php error. You may want to see if you can incress error reporting.
You can check if your php installastion has the mysql driver by looking in your php.ini and also checking with.
phpinfo();
It is almost always about config. https://bbs.archlinux.org/viewtopic.php?id=90133