Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS 6.3 install MySQL-5.7.10

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are three types of MySQL installations:

1. RPM package installation

2. Binary package installation

3. Source code installation.

The first way is relatively simple, directly RPM package installation is OK, or through the yum source to install, but can not customize the installation directory.

The third way is more complicated.

Generally used in the project is through the binary package to install, this kind of installation can be customized according to the different needs of the enterprise, such as which directory to install, how to configure and so on.

The installation of MySQL5.7 and 5.6 has changed.

CentOS version

[mysql@new ~] $cat / etc/redhat-release

CentOS release 6.3 (Final)

[mysql@new ~] $

Upload the installation file to the server

[mysql@new ~] $ls

Total 535920

-rw-rw-rw-. 1 mysql mysql 548774698 Jan 12 16:53 mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

Extract the installation file

[mysql@new ~] $tar-xvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

Rename directory

[mysql@guoqing ~] $mv mysql-5.7.10-linux-glibc2.5-x86_64 mysql

[mysql@guoqing ~] $ls

Mysql mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

[mysql@guoqing ~] $cd mysql

[mysql@guoqing mysql] $ls

Bin COPYING docs include INSTALL-BINARY lib man README share support-files

Create a new directory data for storing data

[mysql@guoqing mysql] $mkdir data

[mysql@guoqing mysql] $ll

Total 164

Drwxr-xr-x. 2 mysql mysql 4096 Nov 30 03:54 bin

-rw-r--r--. 1 mysql mysql 17987 Nov 30 03:16 COPYING

Drwxrwxr-x. 2 mysql mysql 4096 Jan 12 23:38 data

Drwxr-xr-x. 2 mysql mysql 4096 Nov 30 03:54 docs

Drwxr-xr-x. 3 mysql mysql 4096 Nov 30 03:54 include

-rw-r--r--. 1 mysql mysql 108090 Nov 30 03:26 INSTALL-BINARY

Drwxr-xr-x. 5 mysql mysql 4096 Nov 30 03:54 lib

Drwxr-xr-x. 4 mysql mysql 4096 Nov 30 03:54 man

-rw-r--r--. 1 mysql mysql 2478 Nov 30 03:16 README

Drwxr-xr-x. 28 mysql mysql 4096 Nov 30 03:54 share

Drwxr-xr-x. 2 mysql mysql 4096 Nov 30 03:54 support-files

Copy the my.cnf file

[mysql@guoqing mysql] $su

Password:

[root@guoqing mysql] # cp support-files/my-default.cnf / etc/

[root@guoqing mysql] # chown mysql.mysql / etc/my.cnf

Copy MySQL service files

[root@guoqing mysql] # cp support-files/mysql.server / etc/init.d/mysql

Replace the / usr/local/ reference with your own installation MySQL directory in the MySQL service file

Here is the home/mysql replaced by

[root@guoqing mysql] # vi / etc/init.d/mysql

# 0 means don't wait at all

# Negative numbers mean to wait indefinitely

Service_startup_timeout=900

# Lock directory for RedHat / SuSE.

Lockdir='/var/lock/subsys'

Lock_file_path= "$lockdir/mysql"

# The following variables are only set for letting mysql.server find things.

# Set some defaults

Mysqld_pid_file_path=

If test-z "$basedir"

Then

Basedir=/home/mysql/mysql

Bindir=/home/mysql/mysql/bin

If test-z "$datadir"

Then

Datadir=/home/mysql/mysql/data

Fi

Sbindir=/home/mysql/mysql/bin

Libexecdir=/home/mysql/mysql/bin

Else

Bindir= "$basedir/bin"

If test-z "$datadir"

Then

Datadir= "$basedir/data"

Fi

Sbindir= "$basedir/sbin"

Libexecdir= "$basedir/libexec"

Fi

# datadir_set is used to determine if datadir was set (and so should be

# * not* set inside of the-basedir= handler.)

Datadir_set=

#

# Use LSB init script functions for printing messages, if possible

#

Lsb_functions= "/ lib/lsb/init-functions"

If test-f $lsb_functions; then

. $lsb_functions

Else

"/ etc/rc.d/init.d/mysql" 393L, 10981C written

[root@guoqing mysql] # exit

Exit

Modify my.cnf file, mainly add basedir and datadir

[mysql@guoqing mysql] $vi / etc/my.cnf

[mysqld]

Basedir=/home/mysql/mysql

Datadir=/home/mysql/mysql/data

Socket=/home/mysql/mysql/mysql.sock

User=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

Symbolic-links=0

[mysqld_safe]

Log-error=/home/mysql/mysql/data/mysqld.log

Pid-file=/home/mysql/mysql/data/mysqld/mysqld.pid

"/ etc/my.cnf" 11L, 316C written

Initialize MySQL

MySQL version after 5.7.6 is. / bin/mysqld-- initialize-- user=mysql-- basedir=/home/mysql/mysql-- datadir=/home/mysql/mysql/data/

[mysql@guoqing mysql] $. / bin/mysqld-- initialize-- user=mysql-- basedir=/home/mysql/mysql-- datadir=/home/mysql/mysql/data/

2016-01-12T16:16:14.765586Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2016-01-12T16:16:14.765847Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

2016-01-12T16:16:14.766086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2016-01-12T16:16:15.038567Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-01-12T16:16:15.095995Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-01-12T16:16:15.166081Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: cdd34871-b947-11e5-8a45-0800272a2c8e.

2016-01-12T16:16:15.168260Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-01-12T16:16:15.168776Z 1 [Note] A temporary password is generated for root@localhost: qnW8usF=o;=e (root user password)

The version of MySQL before 5.7.6 is bin/mysql_install_db-- user=mysql

Create a SSL/RSA file

See: http://dev.mysql.com/doc/refman/5.7/en/mysql-ssl-rsa-setup.html

[mysql@guoqing mysql] $bin/mysql_ssl_rsa_setup-- datadir=/home/mysql/mysql/data/

Generating a 2048 bit RSA private key

.. + +

. . +

Writing new private key to 'ca-key.pem'

-

Generating a 2048 bit RSA private key

. +

.. + +

Writing new private key to 'server-key.pem'

-

Generating a 2048 bit RSA private key

. . +

. +

Writing new private key to 'client-key.pem'

-

Add environment variable: / home/mysql/mysql/bin

[mysql@guoqing ~] $vi .bash _ profile

# .bash _ profile

# Get the aliases and functions

If [- f ~ / .bashrc]; then

. ~ / .bashrc

Fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/home/mysql/mysql/bin

Export PATH

~

".bash _ profile" 12L, 198C written

Make the variable effective

[mysql@guoqing] $. .bash _ profile

Start the MySQL service

[mysql@new ~] $service mysql start

Starting MySQL. [OK]

Log in

Using the password in the log above, note that qnW8usF=o;=e is all password content.

[mysql@guoqing] $mysql-uroot-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 4

Server version: 5.7.10

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

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

Affiliates. Other names may be trademarks of their respective

Owners.

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

Modify the password

Mysql > set password=password ('root')

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

Mysql >

At this point, the MySQL5.7.10 installation is complete, the overall and 5.6 installation is not much different, we should pay attention to the length of the root password, initialization mode and so on.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report