Two methods of installing MYSQL5 database in CentOS system

Source: Internet
Author: User
Tags flush reserved socket

To put it simply, it is easy to install the software yum and will automatically resolve the dependencies of each package. RPM is just a package.

CentOS to install MySQL5.5 in RPM mode

First go to the http://dev.mysql.com/downloads/mysql/5.5.html#downloads site to download:

Download the following three files separately (since my machine is 32 bits, here is a 32-bit version of the package, if your machine is 64-bit, please download 64-bit version):

mysql-server-5.5.16-1.rhel5.i386.rpm

mysql-client-5.5.16-1.rhel4.i386.rpm

mysql-devel-5.5.16-1.rhel4.i386.rpm

Use the wget command to download these three files using a breakpoint transfer

Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/

Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/

Wget-c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-devel-5.5.16-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/

Start the installation after the download completes:

RPM-IVH mysql-server-5.5.16-1.rhel4.i386.rpm mysql-client-5.5.16-1.rhel4.i386.rpm mysql-devel-5.5.16-1.rhel4.i386.rpm

Tip After Setup completes, enter MySQL to see if the installation is successful

Mysql

If you receive the following error message: (www.111cn.net)

ERROR 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

Description MySQL service has not started, enter service MySQL start start MySQL service

Service MySQL Start

Then enter MySQL, if the following prompts the message, indicating success.

Welcome to the MySQL Monitor. Commands End With; or G.
Your MySQL Connection ID is 1
Server version:5.5.16 MySQL Community Server (GPL)

Copyright (c), the Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of their respective
Owners.

Type ' help, ' or ' h ' for help. Type ' C ' to clear the current input statement.

The default password is blank for the first installation, and you can use the following command to modify the root password.

Mysqladmin-u Root Password MyPassword

MyPassword The new password you set for you.

And then log in again

Mysql-u root–p

RPM package installed MySQL is not installed/etc/my.cnf file, the solution, only need to copy the/usr/share/mysql directory my-huge.cnf files to the/etc directory, and renamed to MY.CNF can

Cp/usr/share/mysql/my-huge.cnf/etc/my.cnf

Configuring Remote Access

Security considerations, MySQL by default is not allowed remote access, you can use the following to open remote access

Give any host access to data: (www.111cn.net)
Mysql>grant all privileges in *.* to ' root ' @ '% ' with GRANT OPTION

Make the changes take effect
Mysql>flush Privileges

If you still can't access it remotely, it's probably the cause of the firewall, you can open port 3306 in the firewall or simply turn off the firewall.

CentOS 6.3 Source Installation MySQL 5.6 method

1 : Download MySQL

The download address is: http://www.mysql.com/downloads/mysql/5.6.html#downloads

Select "Source Code"-> "
Generic Linux (architecture independent), compressed TAR Archive "


2 : Install the necessary packages

Yum-y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt*-libtool-ltdl-devel* make CMake

3: Compiling the installation

[root@server100 ~]# Groupadd MySQL

[Root@server100 ~]# useradd-r-g MySQL MySQL

[root@server100 ~]# tar-zxvf mysql-5.6. 10.tar.gz

[root@server100 ~]# CD mysql-5.6. 10

[Root@server100 mysql-5.6.10]# CMake.

[root@server100 mysql-5.6.10]# make && make install

------------- The default installation directory is /usr/local/mysql

[Root@server100 ~]# chown-r Mysql.mysql/usr/local/mysql

[Root@server100 ~]# cd/usr/local/mysql/scripts

[root@server100 ~]#./mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data

[Root@server100 ~]# Cd/usr/local/mysql/support-files

[ROOT@SERVER100 support-files]# CP Mysql.server/etc/rc.d/init.d/mysql

[ROOT@SERVER100 support-files]# CP my-default.cnf/etc/my.cnf

[root@server100 ~]# chkconfig--add MySQL

[root@server100 ~]# chkconfig MySQL on

[root@server100 ~]# service MySQL start

Starting MySQL success!

[root@server100 support-files]# MySQL

Welcome to the MySQL Monitor. Commands End With; or G.

Your MySQL Connection ID is 1

Server version:5.6.10 Source Distribution

Copyright (c), 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark the Oracle Corporation and/or its

Affiliates. Names may trademarks of their respective

Owners.

Type ' help, ' or ' h ' for help. Type ' C ' to clear the current input statement.

Mysql>

mysql> status;

--------------

MySQL Ver 14.14 distrib 5.6.10, for Linux (i686) using Editline Wrapper

Connection id:1

Current database:

Current User:root@localhost

Ssl:not in use

Current Pager:stdout

Using outfile: '

Using delimiter:;

Server version:5.6.10 Source Distribution

Protocol version:10

Connection:localhost via UNIX socket

Server Characterset:utf8

Db Characterset:utf8

Client Characterset:utf8

Conn. Characterset:utf8

UNIX Socket:/tmp/mysql.sock

Uptime:5 min sec

Threads:1 questions:5 Slow queries:0 opens:70 Flush tables:1 Open tables:63 queries per second avg:0.014

--------------

Mysql>

thus far MySQL installation completed.

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.