Technology Sharing

Solution to mysql command prompt in centos9

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

  • There is no official plugin for MySQL in CentOS 9 because MySQL is not the default database for CentOS, it is a part of MariaDB.

  • If you want a command line MySQL client, you can use a third-party tool such as mycli

  • First, make sure MySQL has been installed and the operating system is centos9.

1. Install mycli:

CentOS 9 usually comes with Python 3 pre-installed, which can be installed using pip

[root@localhost ~]# pip install mycli
bash: pip: 未找到命令...
  • 1
  • 2

2. Install pip

Continue to wait, the system will prompt whether to install pip, enter y

安装软件包“python3-pip”以提供命令“pip”? [N/y] y

  • 1
  • 2

Continue typing y

下列软件包必须安装:
 python3-pip-21.3.1-1.el9.noarch        A tool for installing and managing Python3 packages
继续更改? [N/y] y

  • 1
  • 2
  • 3
  • 4

As shown in the figure:
insert image description here

Wait for the progress bar to fill up

3. Installation completion effect

insert image description here

4. Login

grammar:

mycli -h 地址 -u 用户名 -p'密码'
  • 1

like:

mycli -uroot -p'ChenFuguo*****';
  • 1

When prompted, press the up and down keys on the keyboard to select the prompt content.
The prompt content turns black to indicate that it is selected, and you can complete it by pressing Enter.
insert image description here