cancel
Showing results for 
Search instead for 
Did you mean: 
jonawang
Flight Engineer
Flight Engineer
  • 6,136 Views

How to setup mysql command (working with podman container) ?

Jump to solution

Hello,

   I am practicing DO180 session 3.6 (Loading the Database) on the RHEL Linux virtual machine under VirtualBox. After executing the following "podman run -d ..." command, I encountered failure when run the "mysql -uuser1 -h 127.0.0.1 -pmypa55 -P13306 items < /home/student/DO180/labs/manage-networking/db.sql" command. The failure message is: "bash: mysql: command not found...".

But when run on DO180 Lab environment, it works fine.

podman run --name mysqldb-port -d -v /home/student/local/mysql:/var/lib/mysql/data -p 13306:3306 -e MYSQL_USER=user1 -e MYSQL_PASSWORD=mypa55  -e MYSQL_DATABASE=items -e MYSQL_ROOT_PASSWORD=r00tpa55 registry.redhat.io/rhel8/mysql-80:1

 What's wrong with my VirtualBox RHEL Linux environment ? Thanks for any advice.

Labels (2)
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
jonawang
Flight Engineer
Flight Engineer
  • 6,111 Views

Hi Marek,

   Thank you very much. I SSHed to another VBox Linux (CentOS which has mysql installed. I works fine.

jonawang_0-1655739683775.png

 

Close.

Best regards,

jonawang

View solution in original post

0 Kudos
4 Replies
Marek_Czernek
Flight Engineer Flight Engineer
Flight Engineer
  • 6,129 Views

Hi @jonawang,

You are missing the mysql command. I am not sure which RHEL version you use, but on my Fedora, I can search what packages provide the mysql command by using yum whatprovides $PACKAGE_NAME, for example:

Marek_Czernek_0-1655726507425.png

 

If I install one of those packages, I can use the mysql command. You can find community repositories here, and you can download the mysql binary directly here.

If you want to practice your container knowledge and abilities, you could even use a second mysql container to connect to the first one! I will leave that up to you though ;).

M.

0 Kudos
jonawang
Flight Engineer
Flight Engineer
  • 6,120 Views

Hi Marek,

   Thanks for the feedback. I am trying to run mysql on podman container using the image pulled down from registry.redhat.io/rhel8, as the command shows:

jonawang_0-1655733101442.png

My Linux version is RHEL 8.5. I checked the PATH, both the Lab Env. and my VB RHEL are the same. The image sources are the same, too.

So I am thinking what else I missed in the environment setting ?

0 Kudos
Marek_Czernek
Flight Engineer Flight Engineer
Flight Engineer
  • 6,119 Views

Sure, but if you are using your own RHEL, then you don't have the mysql command installed. The mysql client does not come pre-installed with RHEL, we installed it on the workstation machine, hence why I included steps on how to install in in my previous comment.

0 Kudos
jonawang
Flight Engineer
Flight Engineer
  • 6,112 Views

Hi Marek,

   Thank you very much. I SSHed to another VBox Linux (CentOS which has mysql installed. I works fine.

jonawang_0-1655739683775.png

 

Close.

Best regards,

jonawang

0 Kudos
Join the discussion
You must log in to join this conversation.