0

I am running XAMMP & I installed MYSQL through Homebrew with brew install mysql

However when I run show databases;in the terminal after logging in with mysql -u root

I get this

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| new_cms_db         |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

but in phpmyadmin when I command show databases;

enter image description here

I have browsed every forum and stack overflow question and I cannot find anything that resolves this.

EDIT

enter image description here

1
  • Xampp has an mysql server installation => result with phpmyadmin. When installing mysql with brew you will have installed another mysql server with own databases => databases shown via the command line. That is why you probably got two different results. => Mysql port of xampp will probably be 3308, and mysql server (installed with brew) will have the default 3306 port, you will need to select which mysql server you want to use Commented Jul 8, 2020 at 10:04

1 Answer 1

2

Xampp will have installed a mysql server that is listening on port 3308 (this is used with phpadmin).

When installing mysql with brew it will install another mysql server on the mysql default port 3306. When using the command line mysql -u root without mentioning a port number it will automatically try to connect to mysql server listening in port 3306.

=> You have two different results of databases that are shown

Sign up to request clarification or add additional context in comments.

2 Comments

I think you are right, but when I use mysql -u root -p --port=3308 it still shows the incorrect databases
This is correct, and for this reason I highly advise to not run two MySQL instances on the same machine (unless you have a really good reason for it). I recommend that you remove the Homebrew MySQL since XAMPP includes everything in one installer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.