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

Detailed instructions on installing MySQL tutorial

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly introduces the installation of MySQL tutorial details, I hope you can supplement and update some knowledge, if there are other problems you need to know, you can continue to follow my updated article in the industry information.

This is mainly the installation of mysql-5.5.54.

The basic environment is:

Centos 6.8

Download the mysql-5.5.54 installation package

Create a software storage directory

Mkdir / home/softwares/

Cd / home/softwares/

Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.54.tar.gz

Install the mysql dependency package

Yum install-y cmake

Yum install-y gcc gcc-c++

Yum install-y ncurses-devel.x86_64

Yum install-y cmake.x86_64

Yum install-y libaio.x86_64

Yum install-y bison.x86_64

Yum install-y gcc-c++.x86_64

Yum install-y perl-Module-Build

Yum install-y libtool zilib-devel

Yum install-y libaio.x86_64

Yum install-y perl.x86_64

Yum install-y perl-Module-Pluggable.x86_64

Yum install-y perl-Pod-Escapes.x86_64

Yum install-y perl-Pod-Simple.x86_64

Yum install-y perl-libs.x86_64

Yum install-y perl-version.x86_64

Yum install-y openssl openssl-devel ncurses ncurses-devel

2. Create user and group partitions

Groupadd mysql

Useradd mysql-g mysql-M-s / sbin/nologin

3. Decompress mysql-5.5.54.tar.gz

Tar-zxvf mysql-5.5.54.tar.gz & & cd mysql-5.5.54/ & & chmod + x *

4. Compile and install

Cmake\ # # is equivalent to config

-DCMAKE_INSTALL_PREFIX=/u01/app/mysql/db\ # # directory where the database is installed

-DSYSCONFDIR=/u01/app/mysql/db/etc\ # # configuration files installed in the database. Do not use the original default files to avoid reading the wrong configuration files during multiple upgrades.

-DMYSQL_DATADIR=/u01/data/mysql/db/data\ # # the default location of the database for storing database tables

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\

-DWITH_BLACKHOLE_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DMYSQL_UNIX_ADDR=/u01/app/mysql/db/mysql.sock\ # # Local communication log

-DMYSQL_TCP_PORT=3306\

-DENABLED_LOCAL_INFILE=1\

-DWITH_PARTITION_STORAGE_ENGINE=1\

-DEXTRA_CHARSETS=all\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

Make install

5. Write configuration files

Cd / u01/app/mysql/db/ & & mkdir etc & & cd etc

Mkdir etc

Vi my.cnf

Cat my.cnf

[mysqld]

# data#

User=mysql

Basedir = / u01/app/mysql/db

Datadir = / u01/app/mysql/data

Innodb_log_group_home_dir=/u01/app/mysql/engine/innolog

Innodb_log_file_size = 50m

Innodb_data_home_dir=/u01/app/mysql/engine/innodata

# innodb_data_file_path = ibdata1:100M;ibdata2:150M:autoextend

Innodb_data_file_path = ibdata1:100M:autoextend

Log-bin = / u01/app/mysql/log/mysql-binlog

Log-bin-index = / u01/app/mysql/log/mysql-bin.index

Binlog_cache_size = 32m

Max_binlog_size=512M

Binlog_format=row

Innodb_file_per_table=1

Log-error = / u01/app/mysql/mysql-error.log

Pid-file = / u01/app/mysql/mysql.pid

Skip-name-resolve

Socket=/u01/app/mysql/mysql.sock

# pool#

# * skip-innodb*

Innodb_additional_mem_pool_size = 64m

Innodb_buffer_pool_size=256M

Innodb_write_io_threads = 8

Innodb_read_io_threads = 8

Innodb_thread_concurrency = 16

Innodb_flush_log_at_trx_commit = 1

Innodb_log_buffer_size = 16m

Innodb_log_file_size = 512m

Innodb_log_files_in_group = 3

Innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

Port=3306

Server-id= 1

# * global cache * *

Read_buffer_size = 32m

Read_rnd_buffer_size = 128m

Sort_buffer_size = 64m

Join_buffer_size = 64m

# * query cache * *

Query_cache_size = 128m

Query_cache_limit = 4m

# * bin log * *

# log_slave_updates

Log_warnings

# others#

# * transaction***

Default-storage-engine = INNODB

Transaction_isolation = REPEATABLE-READ

# * thread * *

Thread_cache_size = 16

Thread_stack = 512K

# * network * *

Back_log = 512

# skip-networking

Max_connections = 3000

Max_connect_errors = 30

Table_open_cache = 4096

Max_allowed_packet = 32m

Max_heap_table_size = 512m

# * char set * *

Character-set-server = utf8

# explicit_defaults_for_timestamp = true

# * tmp table * *

Tmp_table_size = 128m

# * slow query log * *

Slow_query_log

Long_query_time = 10

[mysqldump]

Quick

Max_allowed_packet = 32m

[mysql]

Auto-rehash

[myisamchk]

Key_buffer_size = 12m

Sort_buffer_size = 12m

Read_buffer = 32m

Write_buffer = 32m

[mysqlhotcopy]

Interactive-timeout

[client]

Socket=/u01/app/mysql/mysql.sock

Port=3306

6. Copy the mysql startup script commands to / etc/init.d/

Cp / u01/app/mysql/db/support-files/mysql.server / etc/init.d/mysqld & & chmod + x / etc/init.d/mysqld

Chmod + x / etc/init.d/mysqld

7. Create a directory according to my.cnf he will not automatically create a directory

Mkdir-p / u01/app/mysql/data/engine/innolog

Mkdir-p / u01/app/mysql/data/engine/innodata

Mkdir-p / u01/app/mysql/data/mysql-binlog

Mkdir-p / u01/app/mysql/log/

Chown mysql. / u01/app/mysql/-R

Cd / u01/app/mysql/db

8. initialization statement database installation specified directory, database storage directory by default

. / scripts/mysql_install_db-- basedir=/u01/app/mysql/db-- datadir=/u01/app/mysql/data-- user=mysql

Change environment variables

Vim / .bash_profile

PATH=$PATH:$HOME/bin:/u01/app/mysql/db/bin/

Environmental variables take effect

Source / .bash_profile

If an error is reported:

/ etc/init.d/mysqld start

Problems with the configuration fil

Starting MySQL... ERROR! The server quit without updating PID file (/ data/mysql/mysql.pid).

Generally, you need to query whether the parameters set by the configuration file are too large or too small, and check whether the machine memory is too small. If it is possible, delete all but the db file and recreate the directory.

# set the password after successful startup #

Mysqladmin-uroot password "123456"

Read the above on the installation of MySQL tutorials detailed explanation, hope to give you in the practical application of some help. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

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

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report