MySQL installation deployment of Linux

Source: Internet
Author: User

MySQL installation configuration steps:


1. Enter/home/oldboy/tools to perform an upload of MySQL database instructions and create a MySQL user

#rz-y Upload Compressed package

[Email protected] tools]# cd/home/oldboy/tools/

[[email protected] tools]# useradd-s/sbin/nologin-m MySQL

[[email protected] tools]# ls

Mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz


2. Unzip the MySQL installation package

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

[[email protected] tools]# ls

mysql-5.6.35-linux-glibc2.5-x86_64 mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz


3. Move the extracted MySQL directory to the specified directory

#没有这个目录则创建 mkdir-p/application

[Email protected] tools]# MV mysql-5.6.35-linux-glibc2.5-x86_64/application/mysql-5.6.35

[Email protected] tools]# ls/application/

mysql-5.6.35


4. Create a soft link for MySQL

[Email protected] tools]# ln-s/application/mysql-5.6.35/application/mysql

[Email protected] tools]# ll/application/

Total 8

lrwxrwxrwx 1 root root 8 23:41 mysql-- /application/mysql-5.6.35

Drwxr-xr-x root root 4096 Mar 8 23:38 mysql-5.6.35

5. Assign the MySQL software owner to the MySQL installation directory
[Email protected] application]# chown-r mysql.mysql/application/mysql/

[email protected] application]# ll mysql/

Total 68

Drwxr-xr-x 2 mysql mysql 4096 Mar 8 23:38 Bin

-rw-r--r--1 mysql mysql 17987 Nov 21:36 COPYING

Drwxr-xr-x 3 mysql mysql 4096 Mar 8 23:38 data

Drwxr-xr-x 2 mysql mysql 4096 Mar 8 23:38 Docs

Drwxr-xr-x 3 mysql mysql 4096 Mar 8 23:38 include

Drwxr-xr-x 3 mysql mysql 4096 Mar 8 23:38 Lib

Drwxr-xr-x 4 mysql mysql 4096 Mar 8 23:38 Man

drwxr-xr-x MySQL mysql 4096 Mar 8 23:38 mysql-test

-rw-r--r--1 mysql mysql 2496 Nov 21:36 README

Drwxr-xr-x 2 mysql mysql 4096 Mar 8 23:38 scripts

drwxr-xr-x MySQL mysql 4096 Mar 8 23:38 Share

Drwxr-xr-x 4 mysql mysql 4096 Mar 8 23:38 sql-bench

Drwxr-xr-x 2 mysql mysql 4096 Mar 8 23:38 support-files


6. Initializing the database
[Email protected] application]#/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir =/application/mysql/data--user=mysql

Installing MySQL system tables ... 2017-03-08 23:50:31 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).
............
Warning:default config FILE/ETC/MY.CNF exists on the system
This file is being read by default by the MySQL server
Either remove it, or use the want
--defaults-file argument to Mysqld_safe when starting the server

7. Copy the script from the MySQL installation directory to the Linux system service and give Execute permissions
[Email protected] application]# Cp/application/mysql/support-files/mysql.server/etc/init.d/mysqld

[Email protected] application]# chmod +x/etc/init.d/mysqld

[Email protected] application]# Ll/etc/init.d/mysqld

-rwxr-xr-x 1 root root 10875 Mar 8 23:51/etc/init.d/mysqld


8. Replace the configuration file

[Email protected] application]# sed-i ' s#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe /etc/init.d/mysqld

9. Overwrite the original configuration file

[Email protected] application]# \CP/APPLICATION/MYSQL/SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF

10. Start the MySQL service

[[email protected] application]#/etc/init.d/mysqld start

Starting mysql.logging to '/application/mysql/data/localhost.err '.
success!

[Email protected] application]# lsof-i:3306 #MySQL默认端口3306
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Mysqld 5189 MySQL 10u IPv6 30071 0t0 TCP *:mysql (LISTEN)

One. Path path and boot-up

[Email protected] application]# echo ' export path=/application/mysql/bin: $PATH ' >>/etc/profile

[Email protected] application]# Source/etc/profile

[[email protected] application]# which MySQL

/application/mysql/bin/mysql

[Email protected] application]# chkconfig--add mysqld

[Email protected] application]# chkconfig mysqld on

[Email protected] application]# chkconfig--list|grep mysqld
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

12. Set the password for the MySQL root user
[Email protected] application]#/application/mysql/bin/mysqladmin-u root password ' oldboy123 '
Warning:using a password on the command line interface can is insecure. #这个只是一个警告, because the password is entered at the command line!


Test if you can log in

[Email protected] application]# mysql-uroot-poldboy123

Warning:using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.6.35 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> quit
Bye

In this step, the MySQL database is installed successfully! MySQL common commands are as follows ↓




MySQL Simple common commands

1. View all databases: show databases;

2. Creation of a database: create databases Oldboy;

3. Delete a database (dangerous): Drop DB Oldboy;

4. Select User,host from Mysql.user;

Query selection: SELECT

User,host field (column)

User table for MySQL database

5. Exit Mysql:quit

6. Authorization to the user: Grant all on wordpress.* to [e-mail protected] ' 172.16.1.% ' identified by ' 123456 '

This article is from the "lming" blog, make sure to keep this source http://lmin32.blog.51cto.com/12206256/1904593

MySQL installation deployment of Linux

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.