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

Install mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Install mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

0. Decompress first

[root@VM_83_223_centos ~] # tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

1. Create a mysql user

[root@VM_83_223_centos scripts] # useradd mysql

2. Set the password of the mysql user

[root@VM_83_223_centos scripts] # passwd mysql

Changing password for user mysql.

New password:

Retype new password:

Passwd: all authentication tokens updated successfully.

3. Set the permissions of the / usr/local/mysql directory

[root@VM_83_223_centos local] # mkdir mysql

[root@VM_83_223_centos local] #

[root@VM_83_223_centos local] # chown-R mysql:mysql mysql/

4. Execute the mysql installation script and report an error

[root@VM_83_223_centos scripts] #. / mysql_install_db

FATAL ERROR: please install the following Perl modules before executing. / mysql_install_db:

Data::Dumper

Solution:

Install the autoconf library, which installs the Data::Dumper module

[root@VM_83_223_centos scripts] # yum install autoconf

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Resolving Dependencies

-> Running transaction check

-> Package autoconf.noarch 0RU 2.69-11.el7 will be installed

-- > Processing Dependency: M4 > = 1.4.14 for package: autoconf-2.69-11.el7.noarch

-> Processing Dependency: perl (Data::Dumper) for package: autoconf-2.69-11.el7.noarch

-> Running transaction check

-> Package m4.x86_64 01.4.16-10.el7 will be installed

-> Package perl-Data-Dumper.x86_64 0RU 2.145-3.el7 will be installed

-> Finished Dependency Resolution

Dependencies Resolved

=

Package Arch Version Repository Size

=

Installing:

Autoconf noarch 2.69-11.el7 os 701k

Installing for dependencies:

M4 x8631 64 1.4.16-10.el7 os 256k

Perl-Data-Dumper x8631 64 2.145-3.el7 os 47k

Transaction Summary

=

Install 1 Package (+ 2 Dependent packages)

Total download size: 1.0 M

Installed size: 2.8 M

Is this ok [y/d/N]: y

Downloading packages:

(1Action3): M4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:00

(2ache 3): perl-Data-Dumper-2.145-3.el7.x86_64.rpm | 47 kB 00:00:00

(3x3): autoconf-2.69-11.el7.noarch.rpm | 701 kB 00:00:00

-

Total 5.7 MB/s | 1.0 MB 00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing: M4-1.4.16-10.el7.x86_64 1amp 3

Installing: perl-Data-Dumper-2.145-3.el7.x86_64 2 Compact 3

Installing: autoconf-2.69-11.el7.noarch 3 Compact 3

Verifying: perl-Data-Dumper-2.145-3.el7.x86_64 1 Compact 3

Verifying: M4-1.4.16-10.el7.x86_64 2Univer 3

Verifying: autoconf-2.69-11.el7.noarch 3 Compact 3

Installed:

Autoconf.noarch 0RO 2.69-11.el7

Dependency Installed:

M4.x86_64 0VOR 1.4.16-10.el7 perl-Data-Dumper.x86_64 0RU 2.145-3.el7

Complete!

5. After the installation is successful, execute the installation script again, and an error occurs again

Root@VM_83_223_centos scripts] #. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data

FATAL ERROR: Could not find. / bin/my_print_defaults

If you compiled from source, you need to run 'make install' to

Copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top

Level of the extracted archive, or pass the-- basedir option

Pointing to that location.

Root@VM_83_223_centos scripts] #. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data

FATAL ERROR: Could not find. / bin/my_print_defaults

If you compiled from source, you need to run 'make install' to

Copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top

Level of the extracted archive, or pass the-- basedir option

Pointing to that location.

According to the error message, go to the bin directory of the mysql installation directory to find out if there is my_print_defaults and find this file.

[root@VM_83_223_centos ~] # ls mysql-5.6.36-linux-glibc2.5-x86_64/bin/

Innochecksum mysql mysql_client_test mysqld_multi mysqlhotcopy mysqltest replace

Msql2mysql mysqlaccess mysql_client_test_embedded mysqld_safe mysqlimport mysqltest_embedded resolveip

Myisamchk mysqlaccess.conf mysql_config mysqldump mysql_plugin mysql_tzinfo_to_sql resolve_stack_dump

Myisam_ftdump mysqladmin mysql_config_editor mysqldumpslow mysql_secure_installation mysql_upgrade

Myisamlog mysqlbinlog mysql_convert_table_format mysql_embedded mysql_setpermission mysql_waitpid

Myisampack mysqlbug mysqld mysql_find_rows mysqlshow mysql_zap

My_print_defaults mysqlcheck mysqld-debug mysql_fix_extensions mysqlslap perror

It seems that it is not without this document, it is not this problem. Take a closer look at the error message and notice that the path is relative and starts with the installation directory of mysql. Initialization is to run the script in the initialization script directory, where there will be no. / bin/my_print_defaults. So go back to the installation directory and execute the initialization script with a relative path.

Solution:

(1) first, copy all the extracted files to the mysql installation directory / usr/bin/mysql

[root@VM_83_223_centos] # cp-R mysql-5.6.36-linux-glibc2.5-x86_64/* / usr/local/mysql/

[root@VM_83_223_centos ~] # cd / usr/local/

[root@VM_83_223_centos local] # cd mysql/

[root@VM_83_223_centos mysql] # ll

Total 68

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 bin

-rw-r--r-- 1 root root 17987 Mar 27 20:59 COPYING

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 data

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 docs

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 include

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 lib

Drwxr-xr-x 4 root root 4096 Mar 27 20:59 man

Drwxr-xr-x 10 root root 4096 Mar 27 21:00 mysql-test

-rw-r--r-- 1 root root 2496 Mar 27 20:59 README

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 scripts

Drwxr-xr-x 28 root root 4096 Mar 27 21:00 share

Drwxr-xr-x 4 root root 4096 Mar 27 21:00 sql-bench

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 support-files

(2) use absolute path to execute installation script

[root@VM_83_223_centos mysql] # / scripts/mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data

Installing MySQL system tables...2018-03-27 21:01:02 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2018-03-27 21:01:02 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.

2018-03-27 21:01:02 0 [Note] / usr/local/mysql/bin/mysqld (mysqld 5.6.36) starting as process 20251.

2018-03-27 21:01:02 20251 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-03-27 21:01:02 20251 [Note] InnoDB: The InnoDB memory heap is disabled

2018-03-27 21:01:02 20251 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-03-27 21:01:02 20251 [Note] InnoDB: Memory barrier is not used

2018-03-27 21:01:02 20251 [Note] InnoDB: Compressed tables use zlib 1.2.3

2018-03-27 21:01:02 20251 [Note] InnoDB: Using Linux native AIO

2018-03-27 21:01:02 20251 [Note] InnoDB: Using CPU crc32 instructions

2018-03-27 21:01:02 20251 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2018-03-27 21:01:02 20251 [Note] InnoDB: Completed initialization of buffer pool

2018-03-27 21:01:02 20251 [Note] InnoDB: The first specified data file. / ibdata1 did not exist: a new database to be created!

2018-03-27 21:01:02 20251 [Note] InnoDB: Setting file. / ibdata1 size to 12 MB

2018-03-27 21:01:02 20251 [Note] InnoDB: Database physically writes the file full: wait...

2018-03-27 21:01:02 20251 [Note] InnoDB: Setting logfile. / ib_logfile101 size to 48 MB

2018-03-27 21:01:03 20251 [Note] InnoDB: Setting logfile. / ib_logfile1 size to 48 MB

2018-03-27 21:01:03 20251 [Note] InnoDB: Renaming logfile. / ib_logfile101 to. / ib_logfile0

2018-03-27 21:01:03 20251 [Warning] InnoDB: New log files created, LSN=45781

2018-03-27 21:01:03 20251 [Note] InnoDB: Doublewrite buffer not found: creating new

2018-03-27 21:01:03 20251 [Note] InnoDB: Doublewrite buffer created

2018-03-27 21:01:03 20251 [Note] InnoDB: 128rollback segment (s) are active.

2018-03-27 21:01:03 20251 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-03-27 21:01:03 20251 [Note] InnoDB: Foreign key constraint system tables created

2018-03-27 21:01:03 20251 [Note] InnoDB: Creating tablespace and datafile system tables.

2018-03-27 21:01:03 20251 [Note] InnoDB: Tablespace and datafile system tables created.

2018-03-27 21:01:03 20251 [Note] InnoDB: Waiting for purge to start

2018-03-27 21:01:03 20251 [Note] InnoDB: 5.6.36 started; log sequence number 0

2018-03-27 21:01:05 20251 [Note] Binlog end

2018-03-27 21:01:05 20251 [Note] InnoDB: FTS optimize thread exiting.

2018-03-27 21:01:05 20251 [Note] InnoDB: Starting shutdown...

2018-03-27 21:01:06 20251 [Note] InnoDB: Shutdown completed; log sequence number 1625977

OK

Filling help tables...2018-03-27 21:01:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2018-03-27 21:01:06 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.

2018-03-27 21:01:06 0 [Note] / usr/local/mysql/bin/mysqld (mysqld 5.6.36) starting as process 20274.

2018-03-27 21:01:06 20274 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-03-27 21:01:06 20274 [Note] InnoDB: The InnoDB memory heap is disabled

2018-03-27 21:01:06 20274 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-03-27 21:01:06 20274 [Note] InnoDB: Memory barrier is not used

2018-03-27 21:01:06 20274 [Note] InnoDB: Compressed tables use zlib 1.2.3

2018-03-27 21:01:06 20274 [Note] InnoDB: Using Linux native AIO

2018-03-27 21:01:06 20274 [Note] InnoDB: Using CPU crc32 instructions

2018-03-27 21:01:06 20274 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2018-03-27 21:01:06 20274 [Note] InnoDB: Completed initialization of buffer pool

2018-03-27 21:01:06 20274 [Note] InnoDB: Highest supported file format is Barracuda.

2018-03-27 21:01:06 20274 [Note] InnoDB: 128rollback segment (s) are active.

2018-03-27 21:01:06 20274 [Note] InnoDB: Waiting for purge to start

2018-03-27 21:01:06 20274 [Note] InnoDB: 5.6.36 started; log sequence number 1625977

2018-03-27 21:01:06 20274 [Note] Binlog end

2018-03-27 21:01:06 20274 [Note] InnoDB: FTS optimize thread exiting.

2018-03-27 21:01:06 20274 [Note] InnoDB: Starting shutdown...

2018-03-27 21:01:08 20274 [Note] InnoDB: Shutdown completed; log sequence number 1625987

OK

To start mysqld at boot time you have to copy

Support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the following commands:

/ usr/local/mysql/bin/mysqladmin-u root password' new-password'

/ usr/local/mysql/bin/mysqladmin-u root-h VM_83_223_centos password' new-password'

Alternatively you can run:

/ usr/local/mysql/bin/mysql_secure_installation

Which will also give you the option of removing the test

Databases and anonymous user created by default. This is

Strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

Cd. ; / usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

Cd mysql-test; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

Http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as / usr/local/mysql/my.cnf and

Will be used by default by the server when you start it.

You may edit this file to change server settings

WARNING: Default config file / etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

-- defaults-file argument to mysqld_safe when starting the server

6. Modify the relevant configuration files

[root@VM_83_223_centos mysql] # ll

Total 72

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 bin

-rw-r--r-- 1 root root 17987 Mar 27 20:59 COPYING

Drwxr-xr-x 5 mysql mysql 4096 Mar 27 21:01 data

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 docs

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 include

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 lib

Drwxr-xr-x 4 root root 4096 Mar 27 20:59 man

-rw-r--r-- 1 root root 943 Mar 27 21:01 my.cnf

Drwxr-xr-x 10 root root 4096 Mar 27 21:00 mysql-test

-rw-r--r-- 1 root root 2496 Mar 27 20:59 README

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 scripts

Drwxr-xr-x 28 root root 4096 Mar 27 21:00 share

Drwxr-xr-x 4 root root 4096 Mar 27 21:00 sql-bench

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 support-files

[root@VM_83_223_centos mysql] # cd support-files/

[root@VM_83_223_centos support-files] # ll

Total 32

-rwxr-xr-x 1 root root 1153 Mar 27 21:00 binary-configure

-rw-r--r-- 1 root root 773 Mar 27 21:00 magic

-rw-r--r-- 1 root root 1126 Mar 27 21:00 my-default.cnf

-rwxr-xr-x 1 root root 1061 Mar 27 21:00 mysqld_multi.server

-rwxr-xr-x 1 root root 894 Mar 27 21:00 mysql-log-rotate

-rwxr-xr-x 1 root root 10565 Mar 27 21:00 mysql.server

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

Cp: overwrite'/ etc/my.cnf'? Y

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

[root@VM_83_223_centos mysql] # ll

Total 72

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 bin

-rw-r--r-- 1 root root 17987 Mar 27 20:59 COPYING

Drwxr-xr-x 5 mysql mysql 4096 Mar 27 21:01 data

Drwxr-xr-x 2 root root 4096 Mar 27 20:59 docs

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 include

Drwxr-xr-x 3 root root 4096 Mar 27 20:59 lib

Drwxr-xr-x 4 root root 4096 Mar 27 20:59 man

-rw-r--r-- 1 root root 943 Mar 27 21:01 my.cnf

Drwxr-xr-x 10 root root 4096 Mar 27 21:00 mysql-test

-rw-r--r-- 1 root root 2496 Mar 27 20:59 README

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 scripts

Drwxr-xr-x 28 root root 4096 Mar 27 21:00 share

Drwxr-xr-x 4 root root 4096 Mar 27 21:00 sql-bench

Drwxr-xr-x 2 root root 4096 Mar 27 21:00 support-files

[root@VM_83_223_centos support-files] # vim / etc/init.d/mysql # if the installation directory of mysql is / usr/local/mysql, you can omit this step

Modify two change values in the file

Basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

7. Configure environment variables

[root@VM_83_223_centos support-files] # vim / etc/profile

Add the following two lines

Export MYSQL_HOME=/usr/local/mysql

Export PATH=$MYSQL_HOME/bin:$PATH

Make the changes effective

[root@VM_83_223_centos support-files] # source / etc/profile

8. Configure the service, start the service and set it to self-startup

[root@VM_83_223_centos support-files] # chkconfig-- add mysql

[root@VM_83_223_centos support-files] #

[root@VM_83_223_centos support-files] # systemctl status mysql.service

● mysql.service-LSB: start and stop MySQL

Loaded: loaded (/ etc/rc.d/init.d/mysql; bad; vendor preset: disabled)

Active: inactive (dead)

Docs: man:systemd-sysv-generator (8)

[root@VM_83_223_centos support-files] #

[root@VM_83_223_centos support-files] # systemctl start mysql.service

[root@VM_83_223_centos support-files] #

[root@VM_83_223_centos support-files] # systemctl status mysql.service

● mysql.service-LSB: start and stop MySQL

Loaded: loaded (/ etc/rc.d/init.d/mysql; bad; vendor preset: disabled)

Active: active (running) since Tue 2018-03-27 21:12:07 CST; 2s ago

Docs: man:systemd-sysv-generator (8)

Process: 21092 ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=0/SUCCESS)

CGroup: / system.slice/mysql.service

├─ 21097 / bin/sh / usr/local/mysql/bin/mysqld_safe-datadir=/usr/local/mysql/data-pid-file=/usr/local/mysql/data/VM_83_223_centos.pid

└─ 21204 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data-plugin-dir=/usr/local/mysql/lib/plugin-user=mysql.

Mar 27 21:12:06 VM_83_223_centos systemd [1]: Starting LSB: start and stop MySQL...

Mar 27 21:12:06 VM_83_223_centos mysql [21092]: Starting MySQL.Logging to'/ usr/local/mysql/data/VM_83_223_centos.err'.

Mar 27 21:12:07 VM_83_223_centos mysql [21092]: SUCCESS!

Mar 27 21:12:07 VM_83_223_centos systemd [1]: Started LSB: start and stop MySQL.

[root@VM_83_223_centos support-files] # systemctl enable mysql.service

Mysql.service is not a native service, redirecting to / sbin/chkconfig.

Executing / sbin/chkconfig mysql on

[root@VM_83_223_centos support-files] #

[root@VM_83_223_centos support-files] # / sbin/chkconfig mysql on

[root@VM_83_223_centos support-files] #

[root@VM_83_223_centos support-files] # chkconfig-- list mysql

Note: This output shows SysV services only and does not include native

Systemd services. SysV configuration data might be overridden by native

Systemd configuration.

If you want to list systemd services use 'systemctl list-unit-files'.

To see services enabled on particular target use

'systemctl list-dependencies [target]'.

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

9. Set the password of the root user

[root@VM_83_223_centos support-files] # / usr/local/mysql/bin/mysqladmin-u root password 'qcloud@2018'

Warning: Using a password on the command line interface can be insecure.

10. Login authorization

[root@VM_83_223_centos support-files] # mysql-uroot-p

Enter password:

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

Your MySQL connection id is 3

Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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.

Mysql > select version ()

+-+

| | version () |

+-+

| | 5.6.36 |

+-+

1 row in set (0.00 sec)

Mysql > select host,user from mysql.user

+-+ +

| | host | user |

+-+ +

| | 127.0.0.1 | root |

| |:: 1 | root |

| | localhost |

| | localhost | root |

| | vm\ _ 83\ _ 223\ _ centos |

| | vm\ _ 83\ _ 223\ _ centos | root |

+-+ +

6 rows in set (0.00 sec)

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' qcloud@2018' WITH GRANT OPTION

Query OK, 0 rows affected (0.00 sec)

Mysql > select host,user from mysql.user

+-+ +

| | host | user |

+-+ +

| |% | root |

| | 127.0.0.1 | root |

| |:: 1 | root |

| | localhost |

| | localhost | root |

| | vm\ _ 83\ _ 223\ _ centos |

| | vm\ _ 83\ _ 223\ _ centos | root |

+-+ +

7 rows in set (0.00 sec)

Mysql > FLUSH PRIVILEGES

Query OK, 0 rows affected (0.00 sec)

Author: SEian.G (hard practice changes in 72, but it is difficult to laugh at 81)

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