CentOS6.3 Install MySQL5.6.10 and modify the MySQL root user password

Source: Internet
Author: User
Tags mkdir iptables firewall

Environment: CentOS 6.3 Minimizes the default installation and configures the network card.

Before installing MySQL, make sure that your Internet connection is normal so that you can download the installation files.

Use the YUM-Y Update directive to upgrade the system to the latest version first.

This installation separates the MySQL data file from the execution file, and if you intend to set it to a different path, pay attention to modifying the corresponding execution command and database initialization script.

# Modify firewall settings, open port 3306

Vi/etc/sysconfig/iptables

-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT

# Reboot the firewall for new settings to take effect

Service Iptables Restart

# New User Groups

Groupadd MySQL

# New users

Useradd mysql-g MySQL

# New Database Execution file directory

Mkdir-p/usr/local/mysql

# New Database Data file directory

Mkdir-p/db/mysql/data

# Modify 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 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 Hosts file, add native IP and host name

192.168.211.100 Centhost.centdomain

# Install the tools and libraries needed to compile the source code

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

# Access to source compression package download directory

Cd/usr/src

# Download Source Compression Package

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

# Unzip the source package

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

# into the Extract source directory

CD mysql-5.6.10

# from the mysql5.5, MySQL source installation began to use CMake, the implementation of the source code compiled configuration script.

CMake

-dcmake_install_prefix=/usr/local/mysql

-dmysql_unix_addr=/usr/local/mysql/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 time will be longer, patiently waiting.

Make

# installation

Make install

# Copy configuration file

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

# Enter Installation path

Cd/usr/local/mysql

# Execute configuration Script

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

# Replication Service startup script

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

# Start MySQL Service

Service MySQL Start

# set up the boot auto start service

Chkconfig MySQL on

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

Modify the password of the MySQL root user and turn on remote connections

mysql> use MySQL;

mysql> desc User;

Mysql> GRANT all privileges in *.* to root@ "%" identified by "root"; The ability to add remote connections to root

mysql> Update user Set Password = Password (' 123456 ') where user= ' root '; Set 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.