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 Mariadb in Oracle Linux 7.1

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Install Mariadb 10.0.38 in Oracle Linux 7.1 because Mariadb is a branch of Mysql and the installation operation is similar.

1. First download the installation media mariadb-10.0.38-linux-glibc_214-x86.tar.gz and upload it to the server's / soft directory

two。 Create users and user groups

[root@cs1 soft] # groupadd mysql

[root@cs1 soft] # useradd-g mysql mysql

3. Extract the media to the / usr/local/ directory

[root@cs1 soft] # cd / usr/local

[root@cs1 local] # gunzip

< /soft/mariadb-10.0.38-linux-glibc_214-x86.tar.gz | tar xvf - mariadb-10.0.38-linux-glibc_214-x86/ mariadb-10.0.38-linux-glibc_214-x86/man/ mariadb-10.0.38-linux-glibc_214-x86/man/man8/ mariadb-10.0.38-linux-glibc_214-x86/man/man8/mysqld.8 ........省略.......... [root@cs1 local]# ls -lrt 总用量 4 drwxr-xr-x. 2 root root 6 5月 8 2014 src drwxr-xr-x. 2 root root 6 5月 8 2014 sbin drwxr-xr-x. 2 root root 6 5月 8 2014 libexec drwxr-xr-x. 2 root root 6 5月 8 2014 libdrwxr-xr-x. 2 root root 6 5月 8 2014 lib drwxr-xr-x. 2 root root 6 5月 8 2014 include drwxr-xr-x. 2 root root 6 5月 8 2014 games drwxr-xr-x. 2 root root 6 5月 8 2014 etc drwxr-xr-x. 5 root root 46 10月 12 2017 share drwxr-xr-x. 2 root root 46 3月 9 2018 bin drwxrwxr-x 13 1021 1004 4096 1月 31 02:40 mariadb-10.0.38-linux-glibc_214-x86 4.创建软链接 [root@cs1 local]# ln -s mariadb-10.0.38-linux-glibc_214-x86 mysql [root@cs1 local]# ls -lrt 总用量 4 drwxr-xr-x. 2 root root 6 5月 8 2014 src drwxr-xr-x. 2 root root 6 5月 8 2014 sbin drwxr-xr-x. 2 root root 6 5月 8 2014 libexec drwxr-xr-x. 2 root root 6 5月 8 2014 libdrwxr-xr-x. 2 root root 6 5月 8 2014 lib drwxr-xr-x. 2 root root 6 5月 8 2014 include drwxr-xr-x. 2 root root 6 5月 8 2014 games drwxr-xr-x. 2 root root 6 5月 8 2014 etc drwxr-xr-x. 5 root root 46 10月 12 2017 share drwxr-xr-x. 2 root root 46 3月 9 2018 bin drwxrwxr-x 13 1021 1004 4096 1月 31 02:40 mariadb-10.0.38-linux-glibc_214-x86 lrwxrwxrwx 1 root root 38 6月 4 14:43 mysql ->

Mariadb-10.0.38-linux-glibc_214-x86

5. Ensure that the directory mysql can be accessed by the user mysql

[root@cs1 local] # cd mysql

[root@cs1 mysql] # chown-R mysql.

[root@cs1 mysql] # chgrp-R mysql.

6. Before installing Mariadb, you must create a directory where Mariadb stores the data and initialize the grant table, execute the mysql_install_db command to install Mariadb, if you use the root user, you must include the-- user option to specify the user, and if the mysql user executes, you can ignore the-- user option. Use the-- basedir=path option to specify the path to the Mariadb installation directory, and the-- datadir=path option to specify the path to the Mariadb data directory. If the-- basedir and-- datadir options are not specified, they create a data directory under the / usr/local/mysql directory.

[root@cs1 mysql] # scripts/mysql_install_db-- user=mysql

Installing MariaDB/MySQL system tables in'. / data'.

190604 14:44:44 [Note]. / bin/mysqld (mysqld 10.0.38-MariaDB) starting as process 19627.

190604 14:44:45 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

190604 14:44:45 [Note] InnoDB: Using mutexes to ref count buffer pool pages

190604 14:44:45 [Note] InnoDB: The InnoDB memory heap is disabled

190604 14:44:45 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

190604 14:44:45 [Note] InnoDB: GCC builtin _ _ atomic_thread_fence () is used for memory barrier

190604 14:44:45 [Note] InnoDB: Compressed tables use zlib 1.2.11

190604 14:44:45 [Note] InnoDB: Using Linux native AIO

190604 14:44:45 [Note] InnoDB: Using CPU crc32 instructions

190604 14:44:45 [Note] InnoDB: Initializing buffer pool, size = 128.0m

190604 14:44:45 [Note] InnoDB: Completed initialization of buffer pool

190604 14:44:45 [Note] InnoDB: The first specified data file. / ibdata1 did not exist: a new database to be created!

190604 14:44:45 [Note] InnoDB: Setting file. / ibdata1 size to 12 MB

190604 14:44:45 [Note] InnoDB: Database physically writes the file full: wait...

190604 14:44:45 [Note] InnoDB: Setting logfile. / ib_logfile101 size to 48 MB

190604 14:44:45 [Note] InnoDB: Setting logfile. / ib_logfile1 size to 48 MB

190604 14:44:46 [Note] InnoDB: Renaming logfile. / ib_logfile101 to. / ib_logfile0

190604 14:44:46 [Warning] InnoDB: New log files created, LSN=45781

190604 14:44:46 [Note] InnoDB: Doublewrite buffer not found: creating new

190604 14:44:46 [Note] InnoDB: Doublewrite buffer created

190604 14:44:46 [Note] InnoDB: 128rollback segment (s) are active.

190604 14:44:46 [Warning] InnoDB: Creating foreign key constraint system tables.

190604 14:44:46 [Note] InnoDB: Foreign key constraint system tables created

190604 14:44:46 [Note] InnoDB: Creating tablespace and datafile system tables.

190604 14:44:46 [Note] InnoDB: Tablespace and datafile system tables created.

190604 14:44:46 [Note] InnoDB: Waiting for purge to start

190604 14:44:46 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 0

190604 14:44:48 [Note] InnoDB: FTS optimize thread exiting.

190604 14:44:48 [Note] InnoDB: Starting shutdown...

190604 14:44:48 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool

190604 14:44:50 [Note] InnoDB: Shutdown completed; log sequence number 1616697

OK

Filling help tables...

190604 14:44:50 [Note]. / bin/mysqld (mysqld 10.0.38-MariaDB) starting as process 19661.

190604 14:44:50 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

190604 14:44:50 [Note] InnoDB: Using mutexes to ref count buffer pool pages

190604 14:44:50 [Note] InnoDB: The InnoDB memory heap is disabled

190604 14:44:50 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

190604 14:44:50 [Note] InnoDB: GCC builtin _ _ atomic_thread_fence () is used for memory barrier

190604 14:44:50 [Note] InnoDB: Compressed tables use zlib 1.2.11

190604 14:44:50 [Note] InnoDB: Using Linux native AIO

190604 14:44:50 [Note] InnoDB: Using CPU crc32 instructions

190604 14:44:50 [Note] InnoDB: Initializing buffer pool, size = 128.0m

190604 14:44:50 [Note] InnoDB: Completed initialization of buffer pool

190604 14:44:50 [Note] InnoDB: Highest supported file format is Barracuda.

190604 14:44:50 [Note] InnoDB: 128rollback segment (s) are active.

190604 14:44:50 [Note] InnoDB: Waiting for purge to start

190604 14:44:50 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 1616697

190604 14:44:50 [Note] InnoDB: FTS optimize thread exiting.

190604 14:44:50 [Note] InnoDB: Starting shutdown...

190604 14:44:51 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool

190604 14:44:53 [Note] InnoDB: Shutdown completed; log sequence number 1616707

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 MariaDB root USER!

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

'. / bin/mysqladmin'-u root password' new-password'

'. / bin/mysqladmin'-u root-h cs1.jy.net password' new-password'

Alternatively you can run:

'. / 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 MariaDB Knowledgebase at http://mariadb.com/kb or the

MySQL manual for more instructions.

You can start the MariaDB daemon with:

Cd'. / bin/mysqld_safe-- datadir='./data'

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

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

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.

You can find additional information about the MySQL part at:

Http://dev.mysql.com

Consider joining MariaDB's strong and vibrant community:

Https://mariadb.org/get-involved/

7. Because the user who installed Mariadb is root, and the data directory must be accessed by the mysql user, modify the user and group permissions of the data directory

[root@cs1 mysql] # chown-R root.

[root@cs1 mysql] # chown-R mysql data

8. Test the startup of Mariadb after the installation is complete

[root@cs1 mysql] # bin/mysqld_safe-- user=mysql &

[1] 19770

[root@cs1 mysql] # 190604 14:45:25 mysqld_safe Logging to'/ usr/local/mysql/data/cs1.jy.net.err'.

190604 14:45:25 mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data

Mysqld_safe is a server-side tool that starts mysqld and is a daemon for mysqld, mysqld_safe plus & runs $BASEDIR/bin/mysqld_safe & in the background. Because mysqld_safe is a daemon for mysqld, the mysqld_safe script continues to monitor the operation of the MySQL server after it is started and restarts it if it crashes. When you start mysqld directly using mysqld_safe, mysqld_safe can use parameter options in mysqld_safe-- help, and other configuration files can be used at this time, which is equivalent to passing parameters to mysqld by mysqld_safe. The mysql.server script actually calls the mysqld_safe script to start the MySQL server, but at this time mysqld_safe cannot use the parameter option, that is, it cannot mysqld_safe-- defaults-file mode.

9. Configure the script that starts Mariadb to enable the service through the service name start command

[root@cs1 mysql] # cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld

[root@cs1 mysql] # cat / etc/init.d/mysqld

[root@cs1 Packages] # service mysqld status

SUCCESS! MariaDB running (19839)

[root@cs1 Packages] # service mysqld stop

Shutting down MariaDB... SUCCESS!

[root@cs1 Packages] # service mysqld start

Starting MariaDB.190604 18:26:04 mysqld_safe Logging to'/ usr/local/mysql/data/cs1.jy.net.err'.

190604 18:26:05 mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data

SUCCESS!

10. Modify root user password

-bash-4.2$ mysql

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

Your MariaDB connection id is 4

Server version: 10.0.38-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)] >

MariaDB [mysql] > set password=password ("123456")

Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql] > exit

-bash-4.2$ mysql-u root-p

Enter password:

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

Your MariaDB connection id is 6

Server version: 10.0.38-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.01sec)

MariaDB [(none)] > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

11. Use the mytop tool to monitor that Mariadb,mytop is also automatically installed during Mariadb installation, while separate installation is required in mysql

-bash-4.2$ mytop-- prompt-u root-d mysql

Password:

Install_driver (mysql) failed: Can't locate DBD/mysql.pm in @ INC (@ INC contains: / usr/local/lib/perl5 / usr/local/share/perl5 / usr/lib/perl5/vendor_perl / usr/share/perl5/vendor_perl / usr/lib/perl5/ usr/share/perl5.) At (eval 13) line 3, line 1.

Perhaps the DBD::mysql perl module hasn't been fully installed

Or perhaps the capitalisation of 'mysql' isn't right.

Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.

At / usr/local/mysql//bin/mytop line 253.

The error message indicates that the perl-DBD-MySQL toolkit is not installed

twelve。 Install the perl-DBD-MySQ toolkit

[root@cs1 bin] # yum install perl-DBD-MySQL

Loaded plug-in: langpacks

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

File:///run/media/jy/OL-7.1%20Server.x86/repodata/repomd.xml: [Errno 14] curl#37-"Couldn't open file / run/media/jy/OL-7.1%20Server.x86/repodata/repomd.xml"

Another mirror is being tried.

Resolving dependencies

-- > checking transaction

-> package perl-DBD-MySQL.x86.0.4.023-5.0.1.el7 will be installed

-- > processing dependency libmysqlclient.so.18 (libmysqlclient_18) (bit), which is required by the package perl-DBD-MySQL-4.023-5.0.1.el7.x86

-- > processing dependency libmysqlclient.so.18 () (bit), which is required by the package perl-DBD-MySQL-4.023-5.0.1.el7.x86

-- > checking transaction

-> package mysql-community-libs.x86.0.5.6.23-3.el7 will be installed

-- > processing dependency mysql-community-common (x86 -) = 5.6.23-3.el7, which is required by the package mysql-community-libs-5.6.23-3.el7.x86

-- > checking transaction

-> package mysql-community-common.x86.0.5.6.23-3.el7 will be installed

-- > resolve dependency completion

Dependency resolution

=

Package Schema version Source size

=

Installing:

Perl-DBD-MySQL x86 4.023-5.0.1.el7 local 140k

Install for dependency:

Mysql-community-common x86 5.6.23-3.el7 local 256k

Mysql-community-libs x86 5.6.23-3.el7 local 2.0m

Transaction summary

=

Install 1 package (+ 2 dependent package)

Total downloads: 2.4m

Installation size: 12 m

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

Downloading packages:

Error downloading packages:

Mysql-community-common-5.6.23-3.el7.x86: [Errno 256] No more mirrors to try.

Perl-DBD-MySQL-4.023-5.0.1.el7.x86: [Errno 256] No more mirrors to try.

Mysql-community-libs-5.6.23-3.el7.x86: [Errno 256] No more mirrors to try.

An error occurred that the relevant toolkit could not be downloaded

13. Mount the operating system ISO file into the system and go to the Packages directory to execute the rpm command to install

Root@cs1 Packages] # ls-lrt mysql*

-rw-rw-r-- 1 root root 13136 May 14 2014 mysql-connector-java-5.1.25-3.el7.noarch.rpm

-rw-rw-r-- 1 root root 145144 August 6 2014 mysql-connector-odbc-5.2.5-6.0.1.el7.x86.rpm

-rw-r--r-- 1 root root 4203 February 19 2015 mysql-community-bench-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 19378376 February 19 2015 mysql-community-client-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 3435828 February 19 2015 mysql-community-devel-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 2624 February 19 2015 mysql-community-common-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 262516 February 19 2015 mysql-community-common-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 19979168 February 19 2015 mysql-community-client-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 3543424 February 19 2015 mysql-community-devel-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 23060740 February 19 2015 mysql-community-embedded-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 23733580 February 19 2015 mysql-community-embedded-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 4916 February 19 2015 mysql-community-embedded-devel-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 2104968 February 19 2015 mysql-community-libs-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 2040356 February 19 2015 mysql-community-libs-5.6.23-3.el7.i686.rpm

-rw-r--r-- 1 root root 68058508 February 19 2015 mysql-community-embedded-devel-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 60224180 February 19 2015 mysql-community-server-5.6.23-3.el7.x86.rpm

-rw-r--r-- 1 root root 59280136 February 19 2015 mysql-community-test-5.6.23-3.el7.x86.rpm

[root@cs1 Packages] # rpm-ihv mysql-community-libs-5.6.23-3.el7.x86.rpm

Warning: mysql-community-libs-5.6.23-3.el7.x86.rpm: header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

Error: dependency detection failed:

Mysql-community-common (x86 -) = 5.6.23-3.el7 is required by mysql-community-libs-5.6.23-3.el7.x86

[root@cs1 Packages] # rpm-ivh mysql-community-common-5.6.23-3.el7.x86.rpm

Warning: mysql-community-common-5.6.23-3.el7.x86.rpm: header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

Preparing. # # [100%]

Upgrading / installing...

1:mysql-community-common-5.6.23-3.e## [100%]

[root@cs1 Packages] # rpm-ihv mysql-community-libs-5.6.23-3.el7.x86.rpm

Warning: mysql-community-libs-5.6.23-3.el7.x86.rpm: header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

Preparing. # # [100%]

Upgrading / installing...

1:mysql-community-libs-5.6.23-3.el7## [100%]

[root@cs1 Packages] # ls-lrt perl-DBD-MySQL

Ls: cannot access perl-DBD-MySQL: there is no such file or directory

[root@cs1 Packages] # ls-lrt perl-DBD-MySQL*

-rw-rw-r-- 1 root root 143092 August 6 2014 perl-DBD-MySQL-4.023-5.0.1.el7.x86.rpm

[root@cs1 Packages] # rpm-ivh perl-DBD-MySQL-4.023-5.0.1.el7.x86.rpm

Warning: perl-DBD-MySQL-4.023-5.0.1.el7.x86.rpm: header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY

Preparing. # # [100%]

Upgrading / installing...

1:perl-DBD-MySQL-4.023-5.0.1.el7 # # [100%]

14. Execute mytop commands to monitor Mariadb

-bash-4.2$ mytop-u root-p 123456

MariaDB on localhost (10.0.38-MariaDB) up 04th up 04purl 21 [15:49:46]

Queries: 170.0 qps: 0 Slow: 0.0 Se/In/Up/De (%): 060.0000Universe 00

Sorts: 0 qps now: 1 Slow qps: 0.0 Threads: 2 (1 / 0) 0000 qps now 00

Handler: (R/W/U/D) 0 / 0 / 0 / 0 Tmp: R/W/U: 89 / 89 / 0

ISAM Key Efficiency: 0.0% Bps in/out: 1.4 / 66.6 Now in/out: 22.6 / 2.9k

Id User Host/IP DB Time Cmd State Query

-

12 root localhost mysql 10 0.0 Sleep

10 root localhost test 0 0.0 Query init show full processlist

At this point, the installation is complete.

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