Centos7 installing MySQL and mysql-connector-c++

Source: Internet
Author: User

Recently in order to build their own development environment, once again on the centos7 to install MySQL and C + + Access environment, hereby record the construction process, convenient for later review

One. Install MySQL

Centos7 default installation of mariadb, resulting in the inability to install MySQL, to install msyql first uninstall MARIADB

1. Uninstalling MARIADB
(1) Execution command: RPM-QA | grep mariadb query for installed MARIADB related packages
For example:
Mariadb-devel-5.5.52-1.el7.x86_64
Mariadb-5.5.52-1.el7.x86_64
Mariadb-server-5.5.52-1.el7.x86_64
Mariadb-libs-5.5.52-1.el7.x86_64
(2) The query to the relevant package is deleted, the execution of the command: RPM-E--nodeps xxxx (xxxx refers to the previous step of the query to the package)
(3) Download the MySQL RPM installation package to MySQL website, download 5.7.1 here for example
(4) Unzip the download of the compressed package, will get a batch of MySQL RPM installation package, installed when there are dependencies, click on the Order of installation
RPM-IVH mysql-community-common-5.7.17-1.el7.x86_64.rpm
RPM-IVH mysql-community-libs-5.7.17-1.el7.x86_64.rpm
RPM-IVH mysql-community-client-5.7.17-1.el7.x86_64.rpm
RPM-IVH mysql-community-server-5.7.17-1.el7.x86_64.rpm
RPM-IVH mysql-community-devel-5.7.17-1.el7.x86_64.rpm

(5) Start MySQL service
Systemctl start mysqld[This is the command for the CENTOS7 Management system service to replace the service command]
Service mysqld Restart

(6) Change the MySQL root password and execute the command
Mysqladmin-u root-p password xxxx (password to be set)
Popup Enter Password:
Continue to enter the root password

(7) Restart MySQL Service
Service mysqld Restart
(8) Check if MySQL service is started
Service MYSQLD Status
(9) Login MySQL test is normal

If it is MySQL 5.7, due to performance attributes, the query will be error
Table ' performance_schema.session_status ' doesn ' t exist
In this case, execute the following command
Mysql_upgrade-u root-p--force
Then restart MySQL

Two. Installing mysql-connector-c++

C + + Access MySQL
Using the official website of mysql-connector-c++
1. Download the corresponding version of the Linux installation package, pay attention to whether it is 32-bit or 64-bit, the system depends on the machine
Mysql-connector-c++-1.1.8-linux-el7-x86-32bit.tar.gz

2. Unzip
TAR-XZVF mysql-connector-c++-1.1.8-linux-el7-x86-64bit.tar.gz

3. Copy the files under Inclue to the/usr/include/
Copy the files under Lib to/usr/lib/


Libmysqlcppconn.so-libmysqlcppconn.so.7
Libmysqlcppconn.so.7-libmysqlcppconn.so.7.1.1.8
libmysqlcppconn.so.7.1.1.8

4. The copied file does not establish a connection, the connection is established in the format above
Command: ln-s srcfile file where srcfile is the source file as a soft link
5. Re-load the configuration of the system library again
/sbin/ldconfig

Centos7 installing MySQL and mysql-connector-c++

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.