In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the introduction of the method of mysql5.6.17 compilation and installation". In the daily operation, I believe that many people have doubts about the method of mysql5.6.17 compilation and installation. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "introduction to the method of mysql5.6.17 compilation and installation". Next, please follow the editor to study!
Let's take a look at the rpm package installation of mysql, and then take a look at the source code compilation, including three installation methods of SRPM source package installation:
Installation of mysql 5.6.17 RPM:
1. Yum installs mysql
Note: delete the / etc/my.cnf file last before installation
Yum localinstall MySQL-*
After installation, it will be in the ~ / .mysql_secret file, which stores the random password for the first time.
Head-1. MySQL _ secret | awk-F:'{print $NF}'
When logging in for the first time, you need to use a password. After logging in to mysql, you must change your password before you can do anything else:
Set password=password ("123")
After installation, a mysql security mechanism file is generated in / usr/bin/:
/ usr/bin/mysql_secure_installation
Second, the source code package installs mysql 5.6.17
Source package installation of mysql5.6.17:
Cmake. Default source package compilation
Useradd-r-s / sbin/nologin mysql
Yum-y install gcc gcc-c++ cmake ncurses-devel
Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DDEFAULT_CHARSET=utf8
-DENABLE_LOCAL_INFILE
Example:
Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/var/lib/mysql
-DSYSCONFDIR=/etc
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
-DENABLED_LOCAL_INFILE=1
-DEXTRA_CHARSETS=all
-DMYSQL_USER=mysql
Description:
DENABLE_LOCAL_INFILE indicates that mysql can read external files
DDEFAULT_CHARSET specified character set
DEXTRA_CHARSETS=all extended character set
DMYSQL_UNIX_ADDR specifies the location of the socket file
DWITH_INNOBASE_STORAGE_ENGINE specifies whether the innodb storage engine is supported (default)
DWITH_ARCHIVE_STORAGE_ENGINE specifies whether the archive storage engine is supported (default)
DWITH_INNODB_MEMCACHED specifies whether memcached is supported
DWITH_BLACKHOLE_STORAGE_ENGINE specifies whether the blackhole storage engine is supported (default)
DWITH_FEDERATED_STORAGE_ENGINE specifies whether the federated storage engine is supported
DWITH_PARTITION_STORAGE_ENGINE specifies whether the database partitioning feature is supported
DWITH_PERFSCHEMA_STORAGE_ENGINE specifies whether the perfschema storage engine is supported (default)
Gmake
Make install
Cd / usr/local/mysql/
Cp support-file/mysql.server / etc/init.d/mysql # mysql service startup script
Configuration file for cp support-file/my-default.cnf / etc/my.cnf # mysql
Vim / etc/my.cnf
Basedir = / usr/local/mysql
Datadir = / var/lib/mysql # if it is not specified at installation, it defaults to the / usr/local/mysql/data directory.
Port = 3306
Socket = / tmp/mysqld.sock
Mkdir / var/lib/mysql
Chown mysql. / var/lib/mysql
Cd / usr/local/mysql/scripts/
. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/var/lib/mysql-- no-defaults # install default mysql system libraries
Ls / var/lib/mysql/
Service mysql start
Test login
Vim / .bash_profile
PATH=: / usr/local/mysql/bin
Source / .bash_profile
Of course, you can set / etc/bashrc and add PATH=$PATH:/usr/local/mysql/bin, which takes effect for all users.
If you install using the shell code in the install file, you need to reinstall the system database after installation.
3. Installation of SRPM source package for mysql5.6.17
# yum-y remove mysql mysql-server cmake
# rm-rf / etc/my.cnf
# yum-y groupinstall "Development tools"
Create a normal user
Cp mysql*.src.rpm / home/ ordinary user /
Chown ordinary user mysql*.src.rpm
Yum-y install rpm-build gcc gcc-c++ cmake ncurses ncurses-devel zlib-devel
Yum-y install libaio-devel
Su-regular user
Rpmbuild ~ # build environment directory
Rpm-ivh mysql*.src.rpm
Cd rpmbuild/SPEC/
It depends on: gperf-3.0.3-9.1.el6.x86_64.rpm and libaio-devel
Rpmbuild-bb mysql.spec
In the last photo, I hope that in the new year, you can soar freely in your own blue sky like seagulls.
After the photo, there is the wrong guide and look at it after you have done the above experiment yourself.
=
Troubleshooting: the following phenomena
[root@node3 lib] # service mysql start
Starting MySQL...The server quit without updating PID file (/ var/lib/mysql/node3.domain40.example.com.pid). [failure]
As a solution, open the relevant lines in / etc/my.cnf:
[mysqld_safe]
Log-error=/var/log/mysql.log
Pid-file=/var/run/mysql/mysqld.pid
If the phenomenon persists, you can create it manually: mkdir-p / var/run/mysql & & chown mysql.mysql / var/run/mysql
If the failure persists, make sure that selinux is off.
If the fault persists: tail-2 / var/log/mysql.log file, reproduce the following line
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
The privileges tables for mysql was not found. Use ls / var/lib/mysql/mysql/ to check that there is nothing in this directory.
Solution:. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/var/lib/mysql reinitialize the system library
Use ls / var/lib/mysql/mysql to check that there are already mysql system library files in this directory.
Service mysql start problem solving
At this point, the study of "introduction to the method of compiling and installing mysql5.6.17" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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: 302
*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.