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

How to install mysql5.6 single instance

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "mysql5.6 single instance how to install", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "mysql5.6 single instance how to install" this article.

Mysql installation

Yum-y install cmake

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\

-DMYSQL_DATADIR=/usr/local/mysql/data\

-DSYSCONFDIR=/etc\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock\

-DMYSQL_TCP_PORT=3306\

-DENABLED_LOCAL_INFILE=1\

-DWITH_PARTITION_STORAGE_ENGINE=1\

-DEXTRA_CHARSETS=all\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci

# utf8_general_ci,gbk_chinese_ci

/ *

Cmake\

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ # installation path

-DMYSQL_DATADIR=/usr/local/mysql/data\ # location of data files

-DSYSCONFDIR=/etc\ # my.cnf path

-DWITH_MYISAM_STORAGE_ENGINE=1\ # supports MyIASM engine

-DWITH_INNOBASE_STORAGE_ENGINE=1\ # supports InnoDB engine

-DWITH_MEMORY_STORAGE_ENGINE=1\ # supports Memory engine

-DWITH_READLINE=1\ # Shortcut key function (I haven't used it)

-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock\ # socket path to connect to the database

-DMYSQL_TCP_PORT=3306\ # Port

-DENABLED_LOCAL_INFILE=1\ # allow data to be imported locally

-DWITH_PARTITION_STORAGE_ENGINE=1\ # installation supports database partitioning

-DEXTRA_CHARSETS=all\ # install all character sets

-DDEFAULT_CHARSET=utf8\ # default character

-DDEFAULT_COLLATION=utf8_general_ci

, /

Make

Make install

Groupadd mysql

Useradd-g mysql mysql

Chown-R mysql:mysql / usr/local/mysql

Compilation option description

Options commonly used when specifying the installation path for installation files

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-specify the stump installable path (default is / usr/local/mysql)

-DMYSQL_DATADIR=/data/mysql-the path to the data file of mysql

-DSYSCONFDIR=/etc-configuration file path

Instructions for enabling other storage engines during compilation

-DWITH_INNOBASE_STORAGE_ENGINE=1-using the INNOBASE storage engine

-DWITH_ARCHIVE_STORAGE_ENGINE=1-often used for logging and aggregation analysis, but does not support indexing

-DWITH_BLACKHOLE_STORAGE_ENGINE=1-Black Hole Storage engine

Introduction to canceling some storage engine instructions during compilation

-DWITHOUT__STORAGE_ENGINE=1

Examples are as follows:

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1

-DWITHOUT_FEDERATED_STORAGE_ENGINE=1

-DWITHOUT_PARTITION_STORAGE_ENGINE=1

Introduction to the instructions enabled in the process of compilation

-DWITH_READLINE=1-support batch import of mysql data

-DWITH_SSL=system-mysql supports ssl sessions and implements data recovery based on ssl

-DWITH_ZLIB=system-Compression Library

-DWITH_LIBWRAP=0-whether access control can be implemented based on WRAP

Other functional instructions

-DMYSQL_TCP_PORT=3306-default port

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock-default socket file path

-DENABLED_LOCAL_INFILE=1-whether to enable the LOCAL_INFILE feature

-DEXTRA_CHARSETS=all-whether additional character sets are supported

-DDEFAULT_CHARSET=utf8-default coding mechanism

-DDEFAULT_COLLATION=utf8_general_ci-sets the collation of the default language

-DWITH_DEBUG=0-DEBUG function setting

-DENABLE_PROFILING=1-whether the performance analysis feature is enabled

Mysql service script

[root@mysql mysql-5.6.12] # cp support-files/mysql.server / etc/init.d/mysqld # copy script

[root@mysql mysql-5.6.12] # chmod + x / etc/init.d/mysqld # add executable permissions

[root@mysql ~] # chkconfig-- add mysqld # added to sysV service

[root@mysql ~] # chkconfig mysqld on # Boot

Initialize mysql

[root@mysql] # / usr/local/mysql/scripts/mysql_install_db-- datadir=/usr/local/mysql/data-- user=mysql

FATAL ERROR: Could not find. / bin/my_print_defaults

If you compiled from source, you need to run 'make install' to

Copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top

Level of the extracted archive, or pass the-- basedir option

Pointing to that location.

Error! The solution is as follows

[root@mysql data] # / usr/local/mysql/scripts/mysql_install_db-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/data-- user=mysql # mysql initialization

Vi / usr/local/mysql/my.cnf

Binlog-format=ROW

Log-bin=master-bin.log

Log-slave-updates=true

Gtid-mode=on

Enforce-gtid-consistency=true

Master-info-repository=TABLE

Relay-log-info-repository=TABLE

Sync-master-info=1

Slave-parallel-workers=2

Binlog-checksum=CRC32

Master-verify-checksum=1

Slave-sql-verify-checksum=1

Binlog-rows-query-log_events=1

Server-id=1

Report-port=3306

Port=3306

Datadir=/mydata/data

Socket=/tmp/mysql.sock

Report-host=master.magedu.com

Start mysql

[root@ray ~] # service mysqld start

Starting MySQL.. [OK]

View Port

Netstat-ntulp | grep: 3306

The mysql command is added to the environment variable

[root@ray ~] # vim / etc/profile.d/mysql.sh

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

Output the man manual of mysql to the search path of the man command

[root@mysql mysql] # vi / etc/man.config

# add a new line

MANPATH / usr/local/mysql/man

Export the library file of mysql

[root@ray ~] # vi / etc/ld.so.conf.d/mysql.conf

/ usr/local/mysql/lib/

[root@mysql mysql] # ldconfig-v

[root@ray ~] # ln-sv / usr/local/mysql/include/ / usr/include/mysql

`/ usr/include/mysql'->` / usr/local/mysql/include/'

[root@ray ~] # ls / usr/include/mysql

Big_endian.h decimal.h m_ctype.h my_byteorder.h my_dir.h my_net.h mysql_com_server.h mysql.h my_xml.h plugin_validate_password.h sslopt-longopts.h

Byte_order_generic.h errmsg.h m_string.h my_compiler.h my_getopt.h my_pthread.h mysqld_ername.h mysql_time.h plugin_audit.h sql_common.h sslopt-vars.h

Byte_order_generic_x86_64.h keycache.h my_alloc.h my_config.h my_global.h mysql mysqld_error.h mysql_version.h plugin_ftparser.h sql_state.h typelib.h

Byte_order_generic_x86.h little_endian.h my_attribute.h my_dbug.h my_list.h mysql_com.h mysql_embed.h my_sys.h plugin.h sslopt-case.h

The above is all the contents of the article "how to install a single instance of mysql5.6". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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