Uninstall the old version of MySQL first
# See if the MySQL database is already installed on the operating system grep MySQL # execution result: mysql-libs-5.1. 3. el6_5.x86_64# Normal deletion may prompt that a dependent component cannot be removed successfully -e mysql-libs-5.1. 3. el6_5.x86_64# Brute Force Delete -e--nodeps mysql-libs-5.1. 3. el6_5.x86_64# to see if the successful grep MySQL has been uninstalled
Uninstall
Install MYSLQ in yum mode
# Get a collection of MySQL versions that can be installed on the Yum server Yum grep mysql# Installation Yum Install-y mysql-server mysql mysql-devel# view installed MySQL-server version -qi mysql-server
installation
Database initialization and related configuration
# The first time you start the MySQL service, the MySQL server initializes the configuration service mysqld start# Restart the MySQL services service mysqld restart# see if MySQL is booting Chkcon Fig--list |grepmysqld# return information mysqld0: Off1: Off2: Off3: Off4: Off5: Off6: off# set mysql boot chkconfig mysqld on# Check if MySQL is booting chkconfig--list |grepmysqld# return information mysqld0: Off1: Off2: On3: On4: On5: On6: off# Password to root account is 19900706 mysqladmin-U root Password'19900706'# login MySQL mysql-U Root-p# Enter password after login # query server current system timeSelectsysdate () from dual; #返回+---------------------+| Sysdate () |+---------------------+| .- One- - on:Ten: at|+---------------------+1RowinchSet (0.00sec) ################################## MySQL database file configuration cd/etc/lsmy.cnfCatmy.cnf# return information [Mysqld]datadir=/var/lib/Mysqlsocket=/var/lib/mysql/Mysql.sockuser=mysql# Disabling Symbolic-links are recommended to prevent assorted security riskssymbolic-links=0[Mysqld_safe]log-error=/var/log/Mysqld.logpid-file=/var/run/mysqld/mysqld.pid# mysql configuration file storage directory/ver/lib/MYSQLCD/var/lib/mysql/ls-l# return information total20488-RW-RW----1MySQL MySQL10485760Nov7 on: Genevaibdata1-RW-RW----1MySQL MySQL5242880Nov7 on: GenevaIb_logfile0-RW-RW----1MySQL MySQL5242880Nov7 on: onib_logfile1drwx------2MySQL MySQL4096Nov7 on: onmysqlsrwxrwxrwx1MySQL MySQL0Nov7 on: Genevamysql.sockdrwx------2MySQL MySQL4096Nov7 on: ontest# above information, MySQL and test are the default two database files when installing # Create your own database xudebiao;# return information MySQL>CREATE DATABASE Xudebiao; Query OK,1Row affected (0.00sec) # Query the existing database file againls-l# return information total20492-RW-RW----1MySQL MySQL10485760Nov7 on: Genevaibdata1-RW-RW----1MySQL MySQL5242880Nov7 on: GenevaIb_logfile0-RW-RW----1MySQL MySQL5242880Nov7 on: onib_logfile1drwx------2MySQL MySQL4096Nov7 on: onmysqlsrwxrwxrwx1MySQL MySQL0Nov7 on: Genevamysql.sockdrwx------2MySQL MySQL4096Nov7 on: ontestdrwx------2MySQL MySQL4096Nov7 on: -xudebiao# database log files/var/log/mysqld.log# Query If there is a listening 3306 port netstat-anp
Configuration
CentOS Install MySQL