MySQL installation (yum, binary, source)

Source: Internet
Author: User

MySQL installation (yum, binary, source)

Directory

  1.1 Yum installation ... 2

  1.2 Binary Mount-mysql-5.7.17. 3

1.2.1 Preparation work ... 3

1.2.2 Unzip, move, authorize ... 3

1.2.3 MySQL configuration ... 3

1.2.4 Startup matters ... 4

  1.3 Source Installation-mysql-5.6.36. 4

1.3.1 Preparation work ... 4

1.3.2 Source installation before ... 4

1.3.3 Source Installation ... 5

1.3.4 Source After installation ... 5

  1.4 Optimization Settings ... 6

1.4.1 Power on auto-start ... 6

1.4.2 Add environment variable ... 6

1.4.3 Set Password ... 6

1.4.4 clean user and useless database (Basic optimization) 6

###=============================================###

1.1 Yum Installation
Yum Installation
# Yum installs yum install mysql mysql-server mysql-devel# boot /etc/init.d/mysqld Start  # go to MySQLMySQL

List of specific packages installed

==================================================Package Arch Version Repository Size==================================================Installing:mysql x86_645.1.73-8.el6_8 Base 895k MySQL-devel x86_64 5.1.73-8.el6_8 Base 130k MySQL-server x86_64 5.1.73-8.el6_8 Base 8.6minstalling fordependencies:keyutils-libs-devel x86_64 1.4-5.el6 Base 29k krb5-devel x86_64 1.10.3-65.EL6 Base 504k Libcom_err-devel x86_64 1.41.12-23.EL6 Base 33k LIBKADM5 x86_641.10.3-65.EL6 Base 143k Libselinux-devel x86_64 2.0.94-7.el6 Base 137k Libsepol-devel x86_64 2.0.41-4.EL6 Base 64K OpenSSL-devel x86_64 1.0.1E-57.EL6 Base 1.2M Perl-dbd-mysql x86_64 4.013-3.EL6 Base 134k Perl-DBI x86_64 1.609-4.el6 Base 705k zlib-devel x86_64 1.2.3-29.el6 Base 44ktransaction Summary======================================================InstallPackage (s)
###=============================================## #1.22 binary Installation-mysql-5.7.171.2.1 preparation work
System: CentOS 6.9 binary package: mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz download to/server/tools/
1.2.2 Unzip, move, authorize
cd/server/tools/tar xf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gzmv mysql-5.7.17- linux-glibc2.5-x86_64/application/mysql-5.7.17-s/application/mysql-5.7.17/application/MySQL # Create user useradd-s/sbin/nologin-m mysql    # recommended to specify UID-   u 666# Authorization Chown-r mysql.mysql/application/mysql-5.7.17
1.2.3 MySQL Configuration
#Initialize/application/mysql-5.7.17/bin/mysqld--initialize--user=mysql--basedir=/application/mysql-5.7.17--datadir=/ application/mysql-5.7.17/Data#record the initial password (be sure to log this password) #This version is not the same as the bottom 5.6 version (do not allow blank password login)#2017-12-13t11:29:09.168632z 1 [Note] A temporary password is generated for [email protected]: +u7nkqlqw!4j
    #Copying configuration files and startup filescp/application/mysql-5.7.17/support-files/my-default.cnf/etc/MY.CNFCP/application/mysql-5.7.17/support-files/mysql.server/etc/init.d/mysqld#Modify startup file contentsSed-i's#/usr/local#/application#g'/application/mysql-5.7.17/bin/mysqld_safe/etc/init.d/mysqld

1.2.4 Startup matters
#Start/etc/init.d/mysqld Start#Change root passwordMysqladmin-uroot-p Password'123456'#Enter MySQL (note:-P cannot be followed directly with the password, otherwise the login fails) [[email protected] bin]#/application/mysql/bin/mysql-uroot-pEnter Password: Paste directly+u7nkqlqw!4j#Change Password[[email protected] bin]#/application/mysql/bin/mysqladmin-uroot-p Password 123456Enter Password: Paste directly+u7nkqlqw!4j[[email protected] bin]#./mysql-uroot-p123456

###=============================================###

1.3 Source Installation-mysql-5.6.36.1.3.1 preparation work

System: CentOS 6.9

SOURCE package: Download the installation package mysql-5.6.36.tar.gz to/server/tools/

: http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36.tar.gz

1.3.2 Source before installation
# Install the dependent package Yum  install  -y  ncurses-devel libaio--# Create user Useradd-s/sbin/nologin-m MySQL    # recommends specifying UID-   u 666

1.3.3 Source Installation
cd/server/tools/Tar XF mysql-5.6.36. TAR.GZCD MySQL-5.6.36CMake.-dcmake_install_prefix=/application/mysql-5.6.36 -dmysql_datadir=/application/mysql-5.6.36/Data-dmysql_unix_addr=/application/mysql-5.6.36/tmp/Mysql.sock-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci-dwith_extra_charsets= All-dwith_innobase_storage_engine=1 -dwith_federated_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwithout_example_storage_engine=1 -dwith_zlib=bundled-dwith_ssl=bundled-denabled_local_infile=1 -dwith_embedded_server=1 -denable_downloads=1 -dwith_debug=0makemake Install#Note:-dmysql_unix_addr=/application/mysql-5.6.36/tmp/mysql.sock \
#此版本需要自己创建tmp Catalog mkdir/application/mysql-5.6.36/tmp/

1.3.4 Source After installation
#Create a soft linkcd/application/LN-s/application/mysql-5.6.36//application/MYSQLCP Support-files/my*.cnf/etc/my.cnf#initializing and configuring the database/application/mysql/scripts/mysql_install_db--basedir=/application/mysql/--datadir=/application/mysql/data-- User=MySQL#AuthorizedChown-r mysql.mysql/application/mysql/#Startup Settingscp/application/mysql/support-files/mysql.server/etc/init.d/Mysqldchmod700/etc/init.d/mysqld#start the MySQL service/etc/init.d/mysqld start

###=============================================## #1.4 Optimization settings 1.4.1 Boot
Chkconfig mysqld on

1.4.2 Adding environment variables
' path=/application/mysql/bin/: $PATH ' >>/etc//etc/profile
Mysql
1.4.3 Setting a password
' oldboy123 '  -uroot-poldboy123

1.4.4 Clean up users and useless databases (basic optimization)
Select User,host fromMysql.user;drop User"'@'DB02';d ROP User"'@'localhost';d ROP User'Root'@'DB02';d ROP User'Root'@':: 1'; Select User,host fromMysql.user;

MySQL installation (yum, binary, source)

Related Article

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.