CentOS6.3 install MySQL5.6.10 and modify the MySQL root User Password

Source: Internet
Author: User

Environment: CentOS 6.3 minimizes the default installation and configures the NIC.

Before installing MySQL, check that the Internet connection is normal to download the installation file.

Use the yum-y update command to upgrade the system to the latest version.

This installation separates the MySQL data file from the execution file. If you want to set a different path, modify the corresponding execution command and database initialization script.

# Modify firewall settings and open port 3306

Vi/etc/sysconfig/iptables

-A input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT

# Restart the firewall to make the new settings take effect

Service iptables restart

# New User Group

Groupadd mysql

# Add a user

Useradd mysql-g mysql

# Create a database execution file directory

Mkdir-p/usr/local/mysql

# Creating a database data file directory

Mkdir-p/db/mysql/data

# Modifying directory owner

Chown-R mysql: mysql/usr/local/mysql

Chown-R mysql: mysql/db/mysql/data

Chown-R mysql: mysql/usr/local/mysql /.

Chown-R mysql: mysql/db/mysql/data /.

# Edit PATH search PATH

Vi/etc/profile

Append these 2 lines to the end of the file:

PATH =/usr/local/mysql/bin:/usr/local/mysql/lib: $ PATH

Export PATH

# Effective PATH search PATH

Source/etc/profile

# Edit the hosts file and add the local IP address and Host Name

192.168.211.100 centhost. centdomain

# Install the tools and libraries required for compiling source code

Yum-y install wget gcc-c ++ ncurses-devel cmake make perl

# Go To The Source Code compressed package download directory

Cd/usr/src

# Download the source code compressed package

Wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/

# Decompress the source code package

Tar-zxv-f mysql-5.6.10.tar.gz

# Enter the decompressed source code directory

Cd mysql-5.6.10

# From mysql5.5, mysql source code Installation started using cmake and executed the source code compilation and configuration script.

Cmake

-DCMAKE_INSTALL_PREFIX =/usr/local/mysql

-DMYSQL_UNIX_ADDR =/usr/local/mysql. sock

-DDEFAULT_CHARSET = utf8

-DDEFAULT_COLLATION = utf8_general_ci

-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

-DWITH_READLINE = 1

-DENABLED_LOCAL_INFILE = 1

-DMYSQL_DATADIR =/db/mysql/data

-DMYSQL_USER = mysql

-DMYSQL_TCP_PORT = 3306

# Compile the source code. This step will take a long time and be patient.

Make

# Installation

Make install

# Copy the configuration file

Cp/usr/local/mysql/support-files/my-default.cnf/etc/my. cnf

# Enter the installation path

Cd/usr/local/mysql

# Execute the configuration script

Scripts/mysql_install_db -- user = mysql -- datadir =/db/mysql/data

# Copy the Service Startup Script

Cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql

# Start the MySQL Service

Service mysql start

# Set automatic start of service upon startup

Chkconfig mysql on

>>>>>>>>>>>>>> Complete

Modify the password of the root user of MySQL and enable remote connection.

Mysql> use mysql;

Mysql> desc user;

Mysql> grant all privileges on *. * TO root @ "%" identified by "root"; // Add the remote connection capability TO the root user

Mysql> update user set Password = password ('000000') where User = 'root'; // set the root user Password

Mysql> select Host, User, Password from user where User = 'root ';

Mysql> flush privileges;

Mysql> exit

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.