Install MySQL database in CentOS

Source: Internet
Author: User

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

Download link: http://pan.baidu.com/share/link? Consumer id = 255483056 & uk = 924063144

Http://pan.baidu.com/share/link? Consumer id = 269901909 & uk = 924063144

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:

MySQL-server-5.1.7-0100%/usr/share/mysql/charsets/README from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  mysql-libs-5.1.61-4/usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.1.7-0.i386.rpm  conflicts with file from  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.

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.