centos7.3 Binary Installation mariadb

Source: Internet
Author: User


centos7.3 Binary Installation mariadb.10.2.8


1. Confirm that there is no maraiadb*

Rpm-qa mariadb* View No package, if any, uninstall with Yum remove


2.useradd-d/app/mysqldb-r-m-s/sbin/nologin MySQL

Getent passwd MySQL

It is recommended to put on logical volumes, and the database will grow, and the partitions that cannot be extended will be more cumbersome to process later.


3. Tar XF mariadb-version-linux-x86_64.tar.gz-c/usr/local

Cd/usr/local

LN-SV mariadb-10.2.8-linux-x86_64 MySQL v display process


4. Preparing the configuration file

Cd/usr/local/mysql

LS support-files/

Mkdir/etc/mysql

Cp/usr/local/mysqlsupport-files/my-huge.cnf/etc/mysql/my.cnf

Vim/etc/mysql/my.cnf

[Mysqld]

DataDir =/app/mysqldb must be added

innodb_file_per_table = on each table as a separate file

Skip_name_resolve = on performance optimization, disables hostname resolution


5../scripts/mysql_install_db--user=mysql--datadir=/app/mysqldb Run the script to create the system database

Ls/app/mysqldb's got something.

(There may be an error, according to the error alert, one after the wrong)

Because it is binary compilation, some configuration file location is set, this point need to be noted.

[Email protected] mysql]#/scripts/mysql_install_db--datadir=/app/mysqldb--user=mysqlinstalling MariaDB/MySQL system tables in '/app/mysqldb ' ... 2017-10-11 20:08:53 140592457275200 [Warning] ' thread_concurrency ' is deprecated and'll be removed in a future release.2 017-10-11 20:08:55 140592457275200 [ERROR]./bin/mysqld:unknown variable ' datedir=/app/mysqldb ' 2017-10-11 20:08:55 140592457275200 [ERROR] Aborting


6. Prepare the service script and start the service

CP Support-files/mysql.server/etc/init.d/mysqld

Chkconfig--list mysqld

Chkconfig--add mysqld

Service mysqld Start

Here's what happens when a service doesn't start

[[email protected] mysql]# service mysqld startstarting mysqld  (via  SYSTEMCTL):  job for mysqld.service failed because the control  process exited with error code. see  "Systemctl status mysqld.service"  and  "Journalctl -xe"  for details.                                                              [failed][[email  protected] mysql]# systemctl status mysqld.service -l  mysqld.service  - LSB: start and stop MySQL   Loaded: loaded  (/etc/ rc.d/init.d/mysqld; bad; vendor preset: disabled)    Active: failed  (result: exit-code)   since wed 2017-10-11 20:20:27 cst; 3min 32s ago      docs: man:systemd-sysv-generator (8)   process: 10519 execstart=/etc/rc.d/init.d/ mysqld start  (code=exited, status=1/failure) oct 11 20:20:26 centos7.magedu.com  systemd[1]: starting lsb: start and stop mysql ... oct 11 20:20:26 centos7.magedu.com mysqld[10519]: starting mysql.171011  20:20:26 mysqld_safe logging to  '/var/log/mariadb/mariadb.log '. Oct 11 20:20:26 centos7.magedu.com mysqld[10519]: 171011 20:20:26 mysqld_ Safe starting mysqld daemon with databases from /app/mysqldboct 11  20:20:26 centos7.magedu.com mysqld[10519]: [133b blob data]oct 11 20:20:27 centos7.magedu.com mysqld[10519]: error! oct 11 20:20:27 centos7.magedu.com systemd[1]: mysqld.service: control  process exited, code=exited status=1oct 11 20:20:27 centos7.magedu.com  Systemd[1]: failed to start lsb: start and stop mysql.oct 11  20:20:27 centos7.magedu.com systemd[1]: unit mysqld.service entered failed  state. Oct 11 20:20:27 centos7.magedu.com systemd[1]: mysqld.service failed.

You can see that the log files are missing and the log files are important to the MySQL database. Sometimes, when a task is half an unexpected interruption, the log can be quickly misplaced. Next we create the log file. Note the permissions. Incorrect permissions can cause the service to fail to start.

Touch/var/log/mariadb/mariadb.log

Chown Mysql/var/log/mariadb/mariadb.log

Chown mysql/var/log/mariadb

Service mysqld Start


7. Secure initialization of the environment configuration

It mainly includes PATH environment variable and security environment.

[Email protected] mysql]# vim/etc/profile.d/mysql.sh

path=/usr/local/mysql/bin/: $PATH

You can open a terminal test at the same time.

A :

[[email protected] bin]# cd /usr/local/mysql/bin[[ Email protected] bin]# ./mysql_secure_installation note: running all parts  OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP  carefully! In order to log into mariadb to secure it, we ' ll need  The currentpassword for the root user.  if you ' ve just  Installed mariadb, andyou haven ' t set the root password yet, the  password will be blank,so you should just press enter here. enter current password for root  (enter for none): 

B: View the currently logged in user

[Email protected] ~]# Mysqlwelcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connection ID is 10Server version:10.2.8-mariadb-log MariaDB servercopyright (c), Oracle, M ARIADB Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(None)]> Select User (); +----------------+| User () |+----------------+| [Email protected] |+----------------+1 row in Set (0.00 sec)

A:

[[email protected] bin]# ./mysql_secure_installation note: running all  parts of this script is recommended for all mariadb       servers in production use!  please read each step  carefully! In order to log into mariadb to secure it, we ' ll need  The currentpassword for the root user.  if you ' ve just  Installed mariadb, andyou haven ' t set the root password yet, the  password will be blank,so you should just press enter here. enter current password for root  (Enter for none): OK,  Successfully used password, moving on ... Setting the root password ensures that nobody can log into the mariadbroot user without the proper  Authorisation. set root password? [y/n] ynew password: re-enter new password:  password updated successfully! Reloading privilege tables.  ... success! by default, a mariadb installation has an anonymous user,  allowing anyoneto log into mariadb without having to have a  user account created forthem.  this is intended only for  Testing, and to make the installationgo a bit smoother.  you  should remove them before moving into aproduction environment. REMOVE ANONYMOUS USERS? [Y/N]

B:

[[email protected] ~]# Mysqlerror 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

After the setup is complete, log in as root and execute the mysql-uroot-p command.



This article is from the "RightNow" blog, make sure to keep this source http://amelie.blog.51cto.com/12850951/1971534

centos7.3 Binary Installation mariadb

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.