How Can I Install the MySQL Client?
MySQL provides client installation packages for different OSs on its official website. Download the MySQL 8.0 client installation package or packages of other versions. The following uses Red Hat Linux as an example to show how to obtain the required installation package and install it.
Procedure
- Obtain the installation package.
Find the link to the required version on the download page. The mysql-community-client-8.0.21-1.el6.x86_64 is used as an example.
Figure 1 Download
Click No thanks, just start my download. to download the installation package.
- Upload the installation package to the ECS.
When you create an ECS, select an OS, such as Red Hat 6.6, and bind an EIP to it. Then, upload the installation package to the ECS using a remote connection tool, and use PuTTY to connect to the ECS.
- Run the following command to install the MySQL client:
sudo rpm -ivh mysql-community-client-8.0.21-1.el6.x86_64.rpm
- If any conflicts occur during the installation, add the replacefiles parameter to the command and try to install the client again. Example:
rpm -ivh --replacefiles mysql-community-client-8.0.21-1.el6.x86_64.rpm
- If a message is displayed prompting you to install a dependency package, you can add the nodeps parameter to the command and install the client again. Example:
rpm -ivh --nodeps mysql-community-client-8.0.21-1.el6.x86_64.rpm
- If any conflicts occur during the installation, add the replacefiles parameter to the command and try to install the client again. Example:
- Use the MySQL client to connect to the database and check whether the client can run properly.
mysql -h <hostIP> -P <port> -u <userName> -p --ssl-ca=<cafile>
Table 1 Parameter description Parameter
Description
<hostIP>
Private IP address.
To obtain this parameter, go to the Basic Information page of the instance and view the private IP address in the Network Information area.
<port>
Database port. By default, the value is 3306.
To obtain this parameter, go to the Basic Information page of the instance and view the database port in the Network Information area.
<userName>
Username of the GaussDB(for MySQL) database administrator account. The default username is root.
<cafile>
SSL certificate file, which should be stored in the same directory where the command is executed.
Example:
To connect to a DB instance through an SSL connection as user root, run the following command:
mysql -h 172.xx.xx.xx -P 3306 -u root -p --ssl-ca=ca.pem
Enter the password of the database account as prompted.
Enter password:
If error information similar to "mysql: error while loading shared libraries: libxxxx: cannot open shared object file: No such file or directory" is displayed, perform the following steps:
For example , if the error "mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory"is displayed,
- Query the current version file of the dynamic library that reports the error on the local host.
Assume that the query result is as follows:
/usr/lib64/libtinfo.so.6.2
/usr/lib64/libtinfo.so.6
- Set up the soft link of the required version.
- Connect to the database again.
mysql -h <hostIP> -P <port> -u <userName> -p --ssl-ca=<cafile>
- Query the current version file of the dynamic library that reports the error on the local host.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.