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

MySQL installation mode

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Single instance _ rpm

1. Upload the installation package

Tar-xf mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar

2. Check whether it is installed

Rpm-qa | grep-I mysqlrpm-qa | grep-I maria if you install yum remove-y package name rm-fr / usr/lib/mysqlrm-fr / usr/include/mysqlrm-fr / etc/my.cnfrm-fr / var/lib/mysqlrm-fr / usr/share/mysqlrm-fr / usr/local/mysqlfind /-name mysql

3. Install MySQL

Mkdir-p / home/mysql/ {3306 ivh mysql-community-libs-5.7.24 3307} / {data,log} chown-R mysql:mysql / homechmod-R 755 / homecd / home/mysql/rpm-ivh mysql-community-common-5.7.24-1.el6.x86_64.rpmrpm-ivh mysql-community-libs-5.7.24-1.el6.x86_64.rpmrpm-ivh mysql-community-client-5.7.24-1.el6.x86_64.rpmrpm-ivh mysql-community-server-5.7.24-1.el6.x86_64.rpm

4 、 my.cnf

Vi / etc/my.cnf modify directory

5. Initialize the database

/ usr/bin/mysql_install_db-user=mysql-datadir=/home/mysql/3306/data cat / root/.mysql_secret

6. Start MySQL

Cd / usr/bin//usr/bin/mysqld_safe-defaults-file=/etc/my.cnf-user=mysql &

7. Log in to MySQL

Mysql-uroot-p-S / home/mysql/3306/mysql.sockSET PASSWORD=PASSWORD ('root'); flush privileges

8. Close MySQL

/ usr/bin/mysqladmin-uroot-proot-S / home/mysql/3306/mysql.sock shutdown

2. Single instance _ glibc

1. Upload the installation package

Tar-xvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.24-linux-glibc2.12-x86_64 / usr/local/mysqlecho 'export PATH=$PATH:/usr/local/mysql/bin' > > / etc/profilesource / etc/profile

2. Create a user / directory

Groupadd mysqluseradd-g mysql mysqlpasswd mysqlmkdir-p / home/mysql/ {3306 home/mysql/ 3307} / {data,log} chown-R mysql:mysql / homechmod-R 755 / home

3 、 my.cnf

Vi / etc/ my.cnf [MySQL] socket=/home/mysql/3306/data/mysql.sockport = 3306 [mysqld] port = 3306#skip-grant-tablesbasedir=/usr/local/mysql datadir=/home/mysql/3306/data/user=mysql log-error=/home/mysql/3306/log/resourcepool-0559.err pid-file=/home/mysql/3306/data/resourcepool-0559.pidsocket=/home/mysql/3306/data/mysql.socksymbolic-links=0server-id=102log-bin=mysql-binbinlog-ignore-db = mysql Information_schemaauto-increment-offset = 1slave-skip-errors = all#auto-increment-increment = 2 format defaultMurray storagecolor engineered MyISAMbinlogically formatted = "MIXED" log_bin_trust_function_creators=1sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLESexpire_logs_days = 7event_scheduler=1relay-log=relay-log

4. Initialize the database

/ usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql-datadir=/home/mysql/3306/data

5. Start / shut down the database

/ usr/local/mysql/bin/mysqld_safe-- defaults-file=/etc/my.cnf-- user=mysql & / usr/local/mysql/bin/mysqladmin-uroot-p-P3306-S / data/mysql/data/mysql.sock shutdown

3. Multi-instance _ glibc

1. Installation dependency

The content of the vi / etc/yum.repos.d/yum.repo file is changed as follows: [base] name=Red Hat Enterprise Linuxbaseurl= file:///media/Server enabled=1gpgcheck=0gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releaseyum install ncurses-devel-yyum install libail-devel-yyum install-y gcc

2. Create a user / directory

Groupadd mysqluseradd-g mysql mysqlpasswd mysqlmkdir-p / home/mysql/ {3306 home/mysql/ 3307} / {data,log} chown-R mysql:mysql / homechmod-R 755 / home

3. Decompress and install

Tar-xvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.24-linux-glibc2.12-x86_64 / usr/local/mysqlecho 'export PATH=$PATH:/usr/local/mysql/bin' > / etc/profilesource / etc/profilevi / etc/my.cnf [client] port=3306 socket=/tmp/mysql.sock [mysqld_multi] mysqld = / usr/local/mysql/bin/mysqld_safe mysqladmin = / usr/local/mysql/bin / mysqladmin log = / home/mysql/mysqld_multi.log [mysqld] user=mysql basedir = / usr/local/mysql sql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES [mysqld3306] mysqld=mysqld mysqladmin=mysqladmin datadir=/home/mysql/3306/data port=3306 server_id=3306 socket=/tmp/mysql_3306.sock log-output=file slow_query_log = 1 long_query_time = 1 slow_query_log_file = / home/mysql/3306/log/slow.log log-error = / home/mysql/3306/log/error_3306.log binlog_format = mixed log-bin = / home/mysql/3306/data/mysql3306_bin [mysqld3307] mysqld=mysqld mysqladmin=mysqladmin datadir=/home / mysql/3307/data port=3307 server_id=3307 socket=/tmp/mysql_3307.sock log-output=file slow_query_log = 1 long_query_time = 1 slow_query_log_file = / home/mysql/3307/log/slow.log log-error = / home/mysql/3307/log/error_3307.log binlog_format = mixed log-bin = / home/mysql/3306/data/mysql3307_bin

4. Initialize the database

/ usr/local/mysql/bin/mysqld-defaults-file=/etc/my.cnf-initialize-insecure-user=mysql

5. Start the database

Set up the startup file

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql

6. Mysqld_multi for multi-instance management

Start all instances: / usr/local/mysql/bin/mysqld_multi start View all instance status: / usr/local/mysql/bin/mysqld_multi report start single instance: / usr/local/mysql/bin/mysqld_multi start 3306 stop single instance: / usr/local/mysql/bin/mysqladmin-u root-p-S / tmp/mysql_3306.sock shutdown View single instance status: / usr/local/mysql/bin/mysqld_multi report 3306mysql- S / tmp/mysql_3306.sock-pSET PASSWORD=PASSWORD ('root') Flush privileges

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