# MYSQL Client is not showing the correct database

**URL:** <https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282>\
**Category:** Off-Topic\
**Created:** [September 1, 2021, 8:56pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282 "2021-09-01T20:56:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankitkothari.18](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@ankitkothari.18](https://www.singlestore.com/forum/u/ankitkothari.18)\
**Post date:** [September 1, 2021, 8:56pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/1 "2021-09-01T20:56:33Z")

</div>

Hello,

My goal is to develop automation using bash on MemSQL database. To do this - I have installed MemSQL through docker desktop on my MAC and to create database and tables I used Single Store Studio. Now to run the bash script, I will use my MAC terminal and mySQL client. I installed MySQL client but when I do try to connect to memsql database, it is connecting to MySQL database by default. How do I connect to MemSQL database through SQL client? Is there any other way to run bash script on MemSQL database?

mysql --default-auth=mysql\_native\_password -h 127.0.0.1 -u root -p -P 3306  
Enter password:  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 22  
Server version: 8.0.26 Homebrew

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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.

show databases;  
±-------------------+  
| Database |  
±-------------------+  
| information\_schema |  
| mysql |  
| performance\_schema |  
| sys |  
±-------------------+  
4 rows in set (0.01 sec)

---

<div class="post-metadata">

**Author:** ![adam](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.singlestore.com/forum/u/adam)\
**Post date:** [September 1, 2021, 11:32pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/2 "2021-09-01T23:32:09Z")

</div>

I would guess your not using the right port? Which port is Singlestore running on? Potentially 3307 ?

-Adam

---

<div class="post-metadata">

**Author:** ![ankitkothari.18](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@ankitkothari.18](https://www.singlestore.com/forum/u/ankitkothari.18)\
**Post date:** [September 2, 2021, 1:41am UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/3 "2021-09-02T01:41:55Z")

</div>

In my docker yaml file I used - 3306:3306 port. And I am using the same port while connect to my SQL command line

---

<div class="post-metadata">

**Author:** ![carl](https://www.singlestore.com/forum/user_avatar/www.singlestore.com/carl/32/364_2.png) [@carl](https://www.singlestore.com/forum/u/carl)\
**Post date:** [September 2, 2021, 11:56pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/4 "2021-09-02T23:56:04Z")

</div>

Hi @ankitkothari.18,  
It sounds like you have MySQL running on port 3306 on your machine. It’s not possible to bind two different services to the same port on a machine - so please either select a different port for SingleStore (which is the new name for “MemSQL”) or turn off MySQL.

Since you mentioned that you were able to connect to SingleStore Studio to create your schema, it sounds like the docker container running SingleStore was at least able to come up. I suggest checking how you connected to Studio. For example, you may be connecting directly to the container IP (could be something like 172.168…), in which case you can use that same IP when connecting to SingleStore on the command line.

If you are still having trouble please include the yaml files you are using so we can debug further.

Cheers,  
Carl

---

<div class="post-metadata">

**Author:** ![ankitkothari.18](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@ankitkothari.18](https://www.singlestore.com/forum/u/ankitkothari.18)\
**Post date:** [September 7, 2021, 8:27pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/5 "2021-09-07T20:27:20Z")

</div>

I have changed the port to 3307 and I still see mysql database in mysql client.

Yaml file used to spin up the database -

cat docker-compose.yaml  
version: ‘2’

services:  
memsql:  
image: ‘memsql/cluster-in-a-box’  
ports:  
- 3307:3306  
- 8080:8080  
environment:  
LICENSE\_KEY: ${LICENSE\_KEY}  
ROOT\_PASSWORD: ‘’  
START\_AFTER\_INIT: ‘Y’

MYSQL Client connection details -  
$ mysql -u root -p -h localhost -P 3307 --default-auth=mysql\_native\_password  
Enter password:  
Welcome to the MySQL monitor. Commands end with ; or \g.  
Your MySQL connection id is 29  
Server version: 8.0.26 Homebrew

Copyright © 2000, 2021, Oracle and/or its affiliates.

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\> status

mysql Ver 8.0.26 for macos10.15 on x86\_64 (Homebrew)

Connection id: 29  
Current database:   
Current user: root@localhost  
SSL: Not in use  
Current pager: stdout  
Using outfile: ‘’  
Using delimiter: ;  
Server version: 8.0.26 Homebrew  
Protocol version: 10  
Connection: Localhost via UNIX socket  
Server characterset: utf8mb4  
Db characterset: utf8mb4  
Client characterset: utf8mb4  
Conn. characterset: utf8mb4  
UNIX socket: /tmp/mysql.sock  
Binary data as: Hexadecimal  
Uptime: 6 days 1 hour 14 min 32 sec

## Threads: 2 Questions: 50 Slow queries: 0 Opens: 178 Flush tables: 3 Open tables: 95 Queries per second avg: 0.000

mysql\>  
mysql\>  
mysql\>  
mysql\> show databases;  
±-------------------+  
| Database |  
±-------------------+  
| information\_schema | |  
| mysql |  
| performance\_schema |  
| sys |  
±-------------------+

mysql\>

---

<div class="post-metadata">

**Author:** ![vkruoso](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/v/5f8ce5/32.png) [@vkruoso](https://www.singlestore.com/forum/u/vkruoso)\
**Post date:** [September 8, 2021, 12:51pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/6 "2021-09-08T12:51:41Z")

</div>

Hi @ankitkothari.18! Looks like your docker-compose is correct, as well as your command line do connect to SingleStore. Can you share the output of `docker ps` and `docker-compose ps`? Something is off here, as you should normally be able to connect using port 3307 the same way you can connect to studio with port 8080.

---

<div class="post-metadata">

**Author:** ![ankitkothari.18](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@ankitkothari.18](https://www.singlestore.com/forum/u/ankitkothari.18)\
**Post date:** [September 8, 2021, 6:30pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/7 "2021-09-08T18:30:43Z")

</div>

> [@vkruoso](#):
>
> `docker-compose ps`

Here is the output -

$ docker ps  
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
33540a14f986 memsql/cluster-in-a-box “/startup” 24 hours ago Up 24 hours 3307/tcp, 0.0.0.0:8080-\>8080/tcp, :::8080-\>8080/tcp, 0.0.0.0:3307-\>3306/tcp, :::3307-\>3306/tcp documents\_memsql\_1

## $ docker-compose ps Name Command State Ports

documents\_memsql\_1 /startup Up 0.0.0.0:3307-\>3306/tcp,:::3307-\>3306/tcp, 3307/tcp, 0.0.0.0:8080-\>8080/tcp,:::8080-\>8080/tcp

Also, few questions

1. Is there specific configuration that we do for single store in my sql client installation?
2. What are the other options here? What are the other ways I can run bash script on my Single Store database?

---

<div class="post-metadata">

**Author:** ![Howard789](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@Howard789](https://www.singlestore.com/forum/u/Howard789)\
**Post date:** [September 15, 2021, 5:01am UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/8 "2021-09-15T05:01:32Z")

</div>

You’re logging into HeidiSQL as `root`, so it’s showing you all databases, but you’re logging into `mysql.exe` as the current Windows user (since that’s the default), so it’s only showing you the databases that that user can see. If you run `mysql.exe` with `--user=root --password=...`, it will show you all databases[.](https://www.myloweslife.win/)

---

<div class="post-metadata">

**Author:** ![fktrdhu](https://www.singlestore.com/forum/letter_avatar_proxy/v4/letter/f/c6cbf5/32.png) [@fktrdhu](https://www.singlestore.com/forum/u/fktrdhu)\
**Post date:** [December 18, 2021, 9:47pm UTC](https://www.singlestore.com/forum/t/mysql-client-is-not-showing-the-correct-database/3282/9 "2021-12-18T21:47:49Z")

</div>

> [@ankitkothari.18](#):
>
> My goal is to develop automation using bash on MemSQL database. To do this - I have installed MemSQL through docker desktop on my MAC and to create database and tables I used Single Store Studio. Now to run the bash script, I will use my MAC terminal and mySQL client. I installed MySQL client but when I do try to connect to memsql database, it is connecting to MySQL database by default. How do I connect to MemSQL database through SQL client? Is there any other way to run bash script on MemSQL database?
> 
> mysql --default-auth=mysql\_native\_password -h 127.0.0.1 -u root -p -P 3306  
> Enter password:  
> Welcome to the MySQL monitor. Commands end with ; or \g.  
> Your MySQL connection id is 22  
> Server version: 8.0.26 Homebrew
> 
> Copyright © 2000, 2021, Oracle and/or its affiliates.
> 
> Oracle is a registered trademark of Oracle Corporation and/or its  
> affiliates. Other names may be trademarks of their respective

May I ask you why you use this particular language if there is a perfect one? I’m just taking courses on SQL right now, and we’re studying all its versions and plugins, so I have to determine for myself which version of the program will suit me the most. But I have some problems with this since I have not devoted enough time to all possible options. Therefore, I am interested in the opinion of people who have been in this field for longer and can give me something and give advice. So far, I’m inclined to work in [mysql tools for visual studio](https://www.devart.com/dbforge/mysql/fusion/), as I’ve seen a lot of excellent reviews about this plugin. But I’d be happy to talk to someone here since I think you guys are already professionals in your field.
