In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Before deployment, let's talk about several ways to install MySQL:
Compile and install: the advantage is that it can be customized and customized according to the company's requirements; the disadvantages: the compilation is complex and the dependency problem is solved.
Binary installation: the advantages do not need to be compiled and decompressed, but the disadvantages of the package are larger.
Yum installation: combines the advantages of the above two, but you need to customize the rpm package and put it in the yum repository
Then you only need to execute a command yuminstall mysql-server-y.
What about the way we choose to install MySQL?
For scenarios that do not require too much database, you can use yum/rpm to install MySQL. For example, if the concurrency is not large, it is only in some application scenarios that require databases, such as internal and internal applications (Zabbix monitoring system, OpenStack backend management). Of course, you can also choose yum or rpm for installation in production scenarios.
However, there are many large websites or portals, when installing MySQL, there will be a variety of customization and initialization requirements. At this time, according to the needs of the enterprise, we should first make the source code package into rpm package, then build our own yum warehouse, and finally install it in the way of yum install mysql-server-y. The advantage of this is that it not only takes into account the advantages of simple yum/rpm installation, but also uses the customizability of the source package installation.
Let's talk about compilation and installation today.
I. system environment and software version
[root@db02 scripts] # cat / etc/redhat-release CentOS release 6.8 (Final) [root@db02 scripts] # uname-aLinux db02 2.6.32-642.el6.x86_64 # 1 SMP Tue May 10 17:27:01 UTC 2016 x86 "64 GNU/Linux
Software version
Subsequent updates to Mysql:mysql-5.5.32 version 5.6.36 Cmake:cmake.x86_64 2.8.12.2-4.el6 # compilation tool
2. Install and deploy MySQL
1, install the dependency package
Yum install ncurses-devel libaio-develrpm-qa ncurses-devel libaio-devel
2. Install cmake, which you need to compile mysql later
Yum install cmake-y
3. Create MySQL users and download software packages
Useradd mysql- s / sbin/nologin-M-u 503id mysqlmkdir-p / home/oldboy/toolscd / home/oldboy/tools/#rz upload the source code package, which can be obtained by using mirror open source community or the following Baidu Cloud has shared # # link: http://pan.baidu.com/s/1qYhRwvi password: 19dntar xf mysql-5.5.32.tar.gz cd mysql-5.5.32
4Jing cmake compilation installation and parameters
# Cmake parameter description http://qiuyt.blog.51cto.com/1229789/1923189
Cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\-DMYSQL_DATADIR=/application/mysql-5.5.32/data\-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DEXTRA_CHARSETS=gbk,gb2312,utf8 Ascii\-DENABLED_LOCAL_INFILE=1\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_FEDERATED_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\-DWITHOUT_PARTITION_STORAGE_ENGINE=1\-DWITH_FAST_MUTEXES=1\-DWITH_ZLIB=bundled\-DENABLED_LOCAL_INFILE=1\-DWITH_READLINE=1\-DWITH_EMBEDDED_SERVER=1\-DWITH_DEBUG=0make-j 2 & & make install&& cd.. #-j can specify multiple cpu at compile time Accelerate compilation # # 5.6.36 using the following # # cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36\ # installation directory-DMYSQL_DATADIR=/application/mysql-5.6.36/data\ # # data storage directory-file path of DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock\ # sock-DDEFAULT_CHARSET=utf8\ # default character set No default Latin-DDEFAULT_COLLATION=utf8_general_ci\ # New database default character set Install all extended character sets without default Latin-DWITH_EXTRA_CHARSETS=all\ # install innodb storage engine-DWITH_FEDERATED_STORAGE_ENGINE=1\ # install FEDERATED storage engine-DWITH_BLACKHOLE_STORAGE_ENGINE=1\ # install blackhole storage engine-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\ # install EXAMPLE storage engine-DWITH_ZLIB=bundled \ # Server supports compressed zlib libraries-DWITH_SSL=bundled\ # supports SSL-DENABLED_LOCAL_INFILE=1\ # whether local files are allowed to be imported-DWITH_EMBEDDED_SERVER=1\ # whether an embedded server is established-DENABLE_DOWNLOADS=1\ # whether to download any files- Does DWITH_DEBUG=0 # include debugging support
# add: if there are database files and startup programs that have been installed in the system, it is best to stop or delete them to avoid conflicts.
Ln-s / application/mysql-5.5.32/ / application/mysql
#-Build files have been written to: / home/oldboy/tools/mysql-5.5.32
Note that there are many options that can be configured at compile time. For more information, please see the appendix at the end or the official documentation:
# # cmake compilation parameters of official 5.6
# http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
3. MySQL 5.6.36 single instance configuration
3.1 configuration
Cd / application/mysql/cp support-files/my*.cnf / etc/my.cnf#cp: overwrite `/ etc/my.cnf'? Y/application/mysql/scripts/mysql_install_db-- basedir=/application/mysql/-- datadir=/application/mysql/data-- user=mysqlchown-R mysql.mysql / application/mysql/cp support-files/mysql.server / etc/init.d/mysqldchmod 700 / etc/init.d/mysqldchkconfig mysqld onchkconfig-- list mysqldmkdir / application/mysql/tmp-pchown-R mysql.mysql / application/mysql//etc/init.d/mysqld start# sets the environment variable echo 'PATH=/application/mysql/bin/: $PATH' > > / etc/profiletail-1 / etc/profilesource / etc/profileecho $PATHmysql
3.2Test MySQL
[root@db02 mysql] # mysqlWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 1Server version: 5.6.36 Source distribution... Omit several lines mysql > show databases;+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | test | +-+ 4 rows in set (0.14 sec)
3.3 error summary of single instance
#
Question 1:
[root@db02 mysql-5.6.36] # / etc/init.d/mysqld startStarting MySQL.Logging to'/ application/mysql-5.6.36/data/db02.err'.170507 11:36:28 mysqld_safe Directory'/ application/mysql-5.6.36/tmp' for UNIX socket file don't exists. ERROR! The server quit without updating PID file (/ application/mysql-5.6.36/data/db02.pid). # # debugging [root@db02 mysql-5.6.36] # mkdir / application/mysql/tmp-p [root@db02 mysql-5.6.36] # chown-R mysql.mysql / application/mysql/ [root@db02 mysql-5.6.36] # / etc/init.d/mysqld startStarting MySQL.Logging to'/ application/mysql-5.6.36/data/db02.err'... SUCCESS!
Question 2:
[root@db02 mysql] # / etc/init.d/mysqld startStarting MySQL... ERROR! The server quit without updating PID file (/ application/mysql-5.6.36/data/db02.pid).
Possible reasons:
1. Authorization
2. Disk space
3. Look at the log and check.
3.4 simple security optimization MySQL
Mysqladmin-u root password 'oldboy123' # # set the mysql password # # select user,host from mysql.user;drop user' @ 'db02';drop user' @ 'localhost';drop user' root'@'db02';drop user 'root'@'::1';select user,host from mysql.user;drop database test;show databases
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.