centos6.7 deployment of MySQL-5.7.13 in 64-bit environments

Source: Internet
Author: User
Tags uuid

System environment:

[Email protected] ~]# cat/etc/redhat-release

CentOS Release 6.7 (Final)

[Email protected] tools]# uname-a

Linux localhost 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 03:35:39 UTC x86_64 x86_64 x86_64 gnu/linux

[Email protected] tools]#

Software Preparation:

[Email protected] tools]# pwd

/opt/tools

[email protected] tools]# LL

Total 674208

-rw-r--r--1 root root 639864682 Jul 17:47 mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

-rw-r--r--1 root root 50516207 may 12:01 mysql-5.7.13.tar.gz

[Email protected] tools]#

Unzip the installation:

[Email protected] tools]# Tar XF mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

[email protected] tools]# LL

Total 674212

Drwxr-xr-x 9 7161 wheel 4096 15:04 mysql-5.7.13-linux-glibc2.5-x86_64

-rw-r--r--1 root root 639864682 Jul 17:47 mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

-rw-r--r--1 root root 50516207 may 12:01 mysql-5.7.13.tar.gz

[Email protected] tools]#

[Email protected] tools]# MV Mysql-5.7.13-linux-glibc2.5-x86_64/usr/local/mysql

[[Email Protected]ocalhost tools]#

Initialize operation (generate initial password):

[Email protected] mysql]#/bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql/ Data

2016-07-22t09:58:15.001776z 0 [Warning] innodb:new log files created, lsn=45790

2016-07-22t09:58:15.062066z 0 [Warning] innodb:creating FOREIGN KEY constraint system tables.

2016-07-22t09:58:15.073009z 0 [Warning] No existing UUID have been found, so we assume that's the first time that thi s server has been started. Generating a new uuid:cebfb8a6-4ff2-11e6-8c8d-005056a01a07.

2016-07-22t09:58:15.074370z 0 [Warning] Gtid table is not a ready-to-be used. Table ' mysql.gtid_executed ' cannot be opened.

2016-07-22t09:58:15.075736z 1 [Note] A temporary password is generated for [email protected]: k_1ljzvh3<-,

[Email protected] mysql]#

ps:mysql5.7 new features: As can be seen above, mysql_install_db is no longer recommended to use, it is recommended to change to mysqld--initialize to complete the initialization of the instance.

Join MySQL for system services:

[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql]# chkconfig mysqld on

[Email protected] mysql]# chkconfig--list|grep mysqld

Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[[email protected] MySQL] #chmod 755/etc/init.d/mysqld

MySQL service starts, restarts, stops

[Email protected] mysql]# serivce mysqld start

[[email protected] mysql]# serivce mysqld stop

[Email protected] mysql]# serivce mysqld restart

[Email protected] mysql]#

Set Environment variables:

[Email protected] mysql]# Vim/etc/profile

Export Path=/usr/local/mysql/bin: $PATH

[Email protected] mysql]#

Check to see if MySQL is open

[Email protected] mysql]# Cd/usr/local/mysql

[Email protected] mysql]# CD support-files/

[[email protected] support-files]#./mysql.server start

Starting MySQL. success!

If you use it, the following error occurs when you start the service:

#./support-files/mysql.server Start

./support-files/mysql.server:line 276:CD:/usr/local/mysql:no such file or directory

Starting MySQL error! Couldn ' t find MySQL server (/usr/local/mysql/bin/mysqld_safe)

At this time we need to modify the Basedir and DataDir directory Paths of the/support-files/mysql.server files for our correct MySQL basedir and datadir paths, as follows:

# Vim Support-files/mysql.server

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

...

Basedir=/usr/local/mysql

Datadir=/data/mysql/data

...

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

# ./support-files/mysql.server start

Starting MySQL. success!

Creating a configuration file

MY.CNF backup that will be generated by default

# Mv/etc/my.cnf/etc/my.cnf.bak

[email protected] support-files]# CP my-default.cnf/etc/my.cnf

Initialize the password of the MySQL user root

Stop the MySQL service first

# Service Mysqld Stop

Go to the MySQL installation directory and execute:

# Cd/usr/local/mysql

# ./bin/mysqld_safe--skip-grant-tables--skip-networking&

[1] 6225

[Email protected] mysql]# 151110 02:46:08 mysqld_safe Logging to '/data/mysql/data/localhost.localdomain.err '.

151110 02:46:08 Mysqld_safe starting mysqld daemon with databases From/data/mysql/data


Also open a terminal (p.s. If the SSH connection is logged in, create an SSH connection), do the following:


# mysql-u Root MySQL

Reading table information for completion of table and column names

Can turn off this feature to get a quicker startup with-a


Welcome to the MySQL Monitor. Commands End With; or \g.

Your MySQL Connection ID is 2

Server version:5.7.13 MySQL Community Server (GPL)

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

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

Affiliates. Other names trademarks of their respective

Owners.

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


mysql> use mysql;

Database changed

mysql> UPDATE user SET Password=password (' 123456 ') WHERE user= ' root ';

ERROR 1054 (42S22): Unknown column ' Password ' in ' Field list '

mysql> Update user Set authentication_string = PASSWORD (' 123456 ') where user = ' root ';

Query OK, 1 row affected, 1 Warning (0.02 sec)

Rows matched:1 changed:1 warnings:1


Mysql> flush Privileges;

Query OK, 0 rows Affected (0.00 sec)


mysql> \s

MySQL Ver 14.14 distrib 5.7.13, for linux-glibc2.5 (x86_64) using Editline Wrapper


Connection id:62

Current database:

Current User: [email protected]

Ssl:not in use

Current Pager:stdout

Using outfile: '

Using delimiter:;

Server Version:5.7.13-log MySQL Community Server (GPL)

Protocol version:10

Connection:localhost via UNIX socket

Server Characterset:utf8

Db Characterset:utf8

Client Characterset:utf8

Conn. Characterset:utf8

UNIX Sockets:/data/aedata/mysql/data/mysql.sock

uptime:46 min sec


Threads:6 questions:6846 Slow queries:0 opens:257 Flush tables:1 Open tables:201 queries per second avg:2.432

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


Mysql>

To this end, set the MySQL user root password and make sure that the MySQL encoding set is UTF8, note that the new version of the Mysql.user table password field is authentication_string


MySQL Remote authorization

The format is as follows:

mysql> grant all [privileges] on db_name.table_name to ' username ' @ ' host ' identified by ' password ';

Examples are as follows:


Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';

Query OK, 0 rows affected, 1 warning (0.04 sec)


mysql> FLUSH privileges;

Query OK, 0 rows Affected (0.00 sec)

Mysql>

or with

Mysql> Grant All on * * to ' root ' @ '% ' identified by ' 123456 ';


To this, completed the installation and configuration of MySQL!!!


Reference case: http://blog.csdn.net/cryhelyxx/article/details/49757217

This article from "Flat Light is true" blog, please be sure to keep this source http://ucode.blog.51cto.com/10837891/1829575

centos6.7 deployment of MySQL-5.7.13 in 64-bit environments

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.