CentOS Server Build (4)-Install MySQL

Source: Internet
Author: User
Tags openssl centos server

1. First check that the system has no MySQL installed

[Email protected] opt]# rpm-qa| grep MySQL

# We see that there is no mysqlinstalled,but there is a mysql Libs Development Package plugin, what does he do?

# Explanation: Because the CentOS6.4 system comes with postfix Services, and this mysql-libs is to support this postfix Service, if we do not use to postfix, then uninstall it, and every mysql-server When installed, the rear comes with the installation on this mysql-libs.

#删除mysl-;ib, the system is clean.

Yum Remove Mysql-libs

2 Download mysql-5.6.21.tar.gz, we are ready to install the/user/local data under/uer/local/data

[[Email protected] ~]# groupadd MySQL #创建用户组mysql [[email protected]~]# useradd-g MySQL mysql-s/bin/false #创建用户mysql cannot telnet[[Email protected]~]#mkdir/usr/local/Mysql[[email protected]~]#mkdir/usr/local/mysql/Data[[email protected]~]#CPmysql-5.6. +.Tar. gz/usr/local
[Email protected] ~]# cd/usr/local/
[Email protected] local]# TAR-XZVF mysql-5.6.21.tar.gz #解压
#安装cmake编译环境和依赖包
[Email protected] local]# yum-y install make gcc-c++ cmake OpenSSL openssl-devel bison-devel ncurses ncurses-devel wget Perl Perl-devel


3. Start compiling and installing MySQL

CMake--no-warn-unused-CLI-dcmake_install_prefix=/usr/local/MySQL-dmysql_datadir=/usr/local/mysql/Data-dmysql_unix_addr=/usr/local/mysql/Mysql.sock-dextra_charsets= All-ddefault_charset=UTF8-ddefault_collation=Utf8_unicode_ci-denable_profiling=1 -denabled_local_infile=1 -dwith_readline=1 -dwith_ssl=system-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_archive_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_memory_storage_engine=1 -dmysql_user=MySQL-dmysql_tcp_port=3306

[[email protected] mysql-5.6.21]# make && make install #等待较长时间

[[email protected] mysql-5.6.21]# make clear #安装完后 clean up the temp file

4. Configure MySQL

chown -R mysql:mysql/usr/local/mysql   #修改mysql目录的所属用户权限

#初始化脚本

[Email protected] data]# CD Mysql/data

[Email protected] data]#/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/ Local/mysql/data--user=mysql

#设置mysql服务开机自动启动
CP support-files/mysql.server/etc/init.d/mysql[[email protected] mysql]# chkconfig MySQL On[[email Protected] mysql]# service MySQL start starting MySQL. SUCCESS! [email protected] mysql]#
[Email protected] mysql]# vim/etc/Profile #修改环境变量 allows you to add/usr/local/mysql/bin[[email protected] mysql]# source using the MySQL command path/etc/Profile #使得配置文件生效 [[email protected] mysql]# MySQL-uroot #使用root (no password at this time) to log into Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connectionIDIs1Server Version:5.6. +Source Distributioncopyright (c) -, the, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h'  forHelp. Type'\c'ToClearThe current input statement.mysql>


mysql> SET PASSWORD = PASSWORD ('123456 ');  #修改root用户的密码mysql> GRANT All privileges on * * to [email protected] '% ' identified by ' password ' with GRANT OPTION;   #root用户使用密码 ' PASSWPRD ' telnet

CentOS Server Build (4)-Install MySQL

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.