Install mysql and centosmysql on servers in Centos

Source: Internet
Author: User

Install mysql and centosmysql on servers in Centos


First, the path and statements here are modified after reading many errors on the Internet and I hope they will be useful to you.

Here, we need to follow this order during installation; otherwise, the corresponding commands may not be found due to a path error.

1. Install cmake
# Install the required dependency package (this command is always input)
Yum-y install gcc libxml2-dev curl screen \
Libpng12-dev autoconf libpcre3-dev make bzip2 \
Libevent-dev patch libjpeg62-dev libcurl4-openssl-dev \
Libfreetype6-dev g ++ libtool libncurses5-dev psmisc lrzsz
 
# Download an object
Wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz

# Compile and install
Tar zxvf cmake-2.8.5.tar.gz
Cd cmake-2.8.5
./Boostrap
Make & make install
Cmake-version
 
Ii. install and configure mysql
# Download source files
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/ftp://ftp.ntu.edu.tw/pub/MySQL/
 
# Creating users and groups
Groupadd mysql
Useradd-g mysql-s/usr/sbin/nologin mysql
 
# Create an installation directory
Mkdir/usr/local/mysql
 
# Create a database directory
Mkdir/usr/local/mysql/data
 
# Decompress
Tar-zxvf mysql-5.5.17.tar.gz
Cd \ mysql-5.5.17
 
# Compile and install mysql
# Cmake Compilation:
Cmake.

// Note:

An error may be reported here. If an error is reported, execute the statement and compile it:

Rm-f CMakeCache.txt

yum install ncurses-devel

# Install mysql
Make & make install
 
# Copy the configuration file
Cp support-files/my-medium.cnf/etc/my. cnf
 
# Set permissions
Chmod + x/usr/local/mysql
Chown-R mysql. mysql/usr/local/mysql
Chown-R mysql: mysql/usr/local/mysql/data
 
# Configure auto-start upon startup
Cp support-files/mysql. server/etc/init. d/mysqld
Chmod + x/etc/init. d/mysqld
Chkconfig -- add mysqld
Chkconfg mysqld on
 
# Modify my. cnf Configuration
Vim/etc/my. cnf
# [Mysqld] Add:
Datadir =/usr/local/mysql/data
Default-storage-engine = MyISAM
 
# Optional values:
Log-error =/usr/local/mysql/data/error. log
Pid-file =/usr/local/mysql/data/mysql. pid
User = mysql
Tmpdir =/tmp
 
# Initializing a database
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data &
 
# Start MySQL
/Usr/local/mysql/bin/mysqld_safe -- defaults-file =/etc/my. cnf &
Or:
/Etc/init. d/mysql start (service mysql start)
 
# Test whether MySQL is started
#1) check whether a mysql process exists
Ps-ef | grep mysql
#2) check whether the port is running
Netstat-tnl | grep 3306
#3) read mysql version information
/Usr/local/mysql/bin/mysqladmin version
 
# So far, MySQL installation is complete

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.