How to install mysql database in centos

Source: Internet
Author: User
This article mainly introduces how to install mysql database in centos. For more information, see CentOS.

1. first download the MySQL installation file. I have installed MySQL5.1.7 here,

2. install the MySQL database server

Go to the folder where the installation package is located and run the command rpm-ivh MySQL-server-5.1.7-0.i386.rpm to install the MySQL server.

If a conflict with the original version is reported, execute the rpm-qa | grep-I mysql command to display the installed Mysql version, my display mysql-libs-5.1.61-4.el6.i686
If so, force delete: rpm-e -- nodeps mysql-libs-5.1.61-4.el6.i686 (force delete because there is a package dependency)

My error message is as follows:

Copy codeThe code is as follows:
MySQL-server-5.1.7-0.i386.rpm
Preparing... ######################################## ### [100%]
File/usr/share/mysql/charsets/README from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/Index. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/ascii. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/greek. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/hebrew. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/koi8r. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/koi8u. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/macce. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/macroman. xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/czech/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/danish/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/dutch/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/english/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/estonian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/french/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/german/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/greek/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/hungarian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/italian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/japanese/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/korean/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/norwegian-ny/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/norwegian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/polish/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/portuguese/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/romanian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/russian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/serbian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/slovak/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/spanish/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/swedish/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686
File/usr/share/mysql/ukrainian/errmsg. sys from install of MySQL-server-5.1.7-0.i386.rpm conflicts with file from package mysql-libs-5.1.61-4.el6.i686

Then run the rpm-ivh MySQL-server-5.1.7-0.i386.rpm installation to install successfully.
I have installed it successfully, but the mysql service cannot be started, and it always fails to be started. Baidu later, because of selinux, it is okay to disable selinux.
Disable selinux: vi/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled, and restart
After selinux is disabled, the mysql service cannot be started. because the installed mysql owner is root, a user mysql will be created during mysql installation, as long as/var/lib/mysql
Run chown-R mysql: mysql/var/lib/mysql.
Now, you can run service mysql start to start the mysql service.

 

3. install the MySQL client
Execute the command rpm-ivh MySQL-client-5.1.7-0.i386.rpm for installation.

4. installation successful

After MySQL is successfully installed, import the SQL file to the database as follows:

Go to MYSQL Command Line Client
1. create database first: create database test note: test is the name of the created database
2. switch to the current database: use test
3. enter \./root/test. SQL or souce/root/test. SQL.

Follow these steps to import the backup SQL script to the database in linux.

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.