I was using MySQL server 5.7 and for another project, I needed to install MariaDB.
I have followed official instructions Mariadb official download page
after the install MySQL login in showing me following output
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 46
Server version: 10.4.6-MariaDB-1:10.4.6+maria~bionic mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> exit
how do I make both servers running up? maybe by different ports/ any identifier.
Plan A:
Be sure they are in separate directories.
Be sure to have separate my.cnf config files.
Use different port numbers. (Perhaps leave the existing one as 3306, then pick a bigger number for the second install.)
Plan B:
Put the second install in a VM. There are still details to iron out of "hostname" and port. Possibly the hostname of the VM cannot be "localhost", thereby forcing use of TCP/IP.
Related
I have MariaDB (foobar_db) running in local environment in Docker. I have a SQL file some_sql_dump.sql that I want to run on this database. This is what I tried:
docker exec -t container_id_here mysql -u root -prootpass foobar_db < some_sql_dump.sql
This takes me into MariaDB's monitor:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.4.13-MariaDB-1:10.4.13+maria~bionic mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [foobar_db]>
It seems like using the arrow (<) to pass in input from some_sql_dump.sql did not work correctly. Why did the arrow not work, and how can I make it run the SQL from the file?
I have just used the "--interactive , -i" option and it seems to work.
$ docker exec -i {container_id} mysql -u root -prootpass foobar_db < some_sql_dump.sql
I run mysql.server stop
then
$ mysql.server stop
Shutting down MySQL
.. SUCCESS!
And mysql configuration is like this. It seems to be stopped.
However, I can run mysql -uroot
$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15 Homebrew
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
What is happening ?
I guess that two mysql are installed because I used homebrew to install mysql. If so, how to stop another one ?
if you want to make sure, you could always ps the MySQL process.
Also, you could check if the port to see if it's been occupied by the MySQL process.
I found the reason. I once run brew services start mysql.
So, even if i run mysql.server stop, soon mysql server restarted.
I disabled auto restart by brew services stop mysql
I am a bit desperate. I've tried to install mysql in Raspbian Strectch but I get instead mariadb.
I've followed this tutorial step by step but I still get mariadb installed.
https://dbahire.com/how-to-install-mysql-server-on-debian-stretch/
pi#raspberrypi:/ $ sudo mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.23-MariaDB-9+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
What can I do?
Why do you want MySQL over MariaDB? They are largely interchangeable so you can probably just use MariaDB, most MySQL things work well with it.
Is there a way to save the connection params(like host, port, username, password, db) to the mysql servers I frequently access as shortcuts?
I am looking for something similar to ssh config for mysql from terminal in ubuntu. preferably with ssh tunneling support as well.
You could use the --defaults-file option combined with an shell alias,
for example:
% cat db01
[mysql]
user=root
password=<your_pwd>
host=<your_host>
% alias my_db01='mysql --defaults-file=db01'
% my_db01
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
So you can create different files with different settings.
So only when I go to my local PhpMyAdmin window, I get the #2002 message.
I searched the net and I found a terminal command to check if Mysql would be running in the first place and it does.
Running /Applications/MAMP/Library/bin/mysql -u root -p
gives me
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.9 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
That doesn't look bad I think so the error must not have much to do with that.
I read that there's the config.inc.php file where you replace the value 'localhost' with '127.0.0.1' but that didn't change the situation.
Then I went looking in MYSQL forums it is suggested to check the my.cnf file to check for certain values. but I can't find it anywhere. Is there another file that has the same function in MAMP?
Since the top-voted answer was hosted on Posterous, which no longer exists, this is a bit of an orphan. The content is archived at Archive.org but just in case that goes away, too, the linked answer was:
Today, I tried to install Mysql on OS X Lion using SQL Packager. I faced a very common issue:
MySQL Forums :: Install :: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Turns out you can regenerate this file in the terminal with this:
ps -e|grep mysqld
sudo mysqld_safe
Thanks David Bocage for the tip.
Alright,
I finally got my PHPmyadmin page loaded again without getting the #2002 error. What I did is I kept reviewing the settings for the mysql socket file until at a certain point my phpmyadmin did show up the way it should. So I'm still not really sure why it happened.
I also noticed there was a portnumber mismatch between the actual port setting in MAMP (8888) and a certain php file I cant remember (where it was 3306) which set to match again. Can't be certain that this is what made it work though.
I had the same problem. Easy fix:
Go to /Application/MAMP/bin/phpMyAdmin/ and open up config.inc.php
on line 71 you see $cfg['Servers'][$i]['port']
For some reason the default ports got switched on my machine, so I set it to 8889. Save and phpmyadmin is back up and working!
Wooo