In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Time: July 30, 2018
Author: Li Qiang
Reference: man,info,magedu handout, almighty internet
Experimental environment: VMware ®Workstation 12 Pro, Centos 6.9 Centos 7.4 SecureCRT Version 8.1.4
Disclaimer: the following English is purely personal translation, English Grade B, welcome to correct, the following content is purely personal understanding, not right or wrong, only reference, piracy does not correct, can be limited, I hope it is not a mistake for children.
Version: v1-2018.7.30
references
1. Https://www.cnblogs.com/BrightMoon/p/4730081.html
2. Https://dev.mysql.com/doc/refman/5.6/en/installing.html
Official download site:
Https://dev.mysql.com/downloads/mysql/
You can download the rpm package, repo repository. Binary bag, etc.
Some mirror sites such as Sohu, Ali, NetEase and so on are not working.
Why most mysql installations use binary installations. Instead of compiling the source code manually?
Mysql uses glibc for development. The glibc library is an underlying api, so as long as it is linux, there will be a glibc library. Therefore, mysql installation does not need to consider whether the environment meets the requirements. Portability is very convenient. It is also possible to copy the compiled binaries directly to another machine.
Rationale: generally install a software under linux, different software requires different function libraries. As a result, there is a phenomenon that one software may not work when copied to another platform. This is why you need to detect the environment first to install the software. Because mysql uses the general glibc function library. No dependence on anything else. Therefore, copying from one platform to another can be common. There is no need to detect the environment. You can use the compiled binary directly.
Manual compilation and installation is troublesome. Based on the characteristics of mysql, binary installation is completely possible.
Note: when you install mysql5.5, you need to use the cmake command, so make sure it is installed on your machine. If not, install the cmake. It also looks troublesome. I don't want to install the latest version for the time being.
How do I upgrade if I use binary installation?
The upgrade still gets the binary package. Then, just change the pointing directory directly to the new directory.
There is no need to involve manual compilation, like php, to achieve the benefits of your own custom modules. Mysql installation does not need to involve modules.
Mysql officially recommends installation: binary installation.
The following are the steps to install binary version 5.6.41
First, prepare the environment before installation:
1. Dependent library check
It mainly depends on whether the binary installation depends on the library, which is needed for database initialization and service startup.
Shell > yum search libaio # search for infoshell > yum install libaio # install library
2. Installation related planning
Software installation directory / usr/loca/app/mysql_13306 database storage directory / data/mysql_13306 port 13306 pid_file / data/mysql_13306/mysql_13306.pid socket / data/mysql_13306/mysql_13306.socket log_error / var/log/mysql_13306.log binary installation steps
1. Create a user
Shell > groupadd mysqlshell > useradd-r-g mysql-s / bin/false mysql
2. Download the binary package
Shell > cd / usr/local/appshell > wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.41-linux-glibc2.12-x86_64.tar.gzshell> tar zxvf mysql-5.6.41-linux-glibc2.12-x86_64.tar.gzshell > mv mysql-5.6.41-linux-glibc2.12-x86_64 mysql_13306shell > ln-s mysql_13306.. / mysql_13306# I think establishing soft links actually works Because the default path is here. This step makes no sense when we install multiple instances. Shell > cd / usr/local/app/mysql_3306shell > rm-rf datashell > ln-s data/ data/mysql_13306
3. Specify user rights for the working directory
Shell > cd mysql_13306shell > scripts/mysql_install_db-- user=mysql # here you can specify the location of the mysql installation and installation data. #-- the path where basedir=path uses the mysqld program-- the path where the datadir=path database is installed # this script is executed by default as #. / bin/mysqld-- bootstrap-- basedir=. -- datadir=/var/lib/mysql-- logshell > chown-R root .shell > chown-R mysql / data/mysql_13306# database data location requires mysql permission. Cannot be set to root permission. Otherwise, it won't start. Shell > scripts/mysql_install_db-user=mysql-basedir=/usr/local/app/mysql_13306-datadir=/usr/local/app/mysql_13306/dataTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER! To do so, start the server Then issue the following commands: / home/ewifi/mysql/bin/mysqladmin-u root password' new-password' / home/ewifi/mysql/bin/mysqladmin-u root-h ewifi-yuhang password' new-password'Alternatively you can run: / home/ewifi/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with: cd. / home/ewifi/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test Perl mysql-test-run.plPlease report any problems at http://bugs.mysql.com/The latest information about MySQL is available on the web at http://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as / home/ewifi/mysql/my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file / etc/my.cnf exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it Or use the--defaults-file argument to mysqld_safe when starting the server/home/ewifi/mysql/bin/mysqld_safe-- defaults-file=/home/ewifi/mysql/my.cnf &
4. Modify the configuration file to specify the installation directory and data directory of mysql
After the installation database script is executed, the my.cnf configuration file is automatically generated under the installation path. The main setting parameters are configured under mysqld. [mysqld] user = mysql / / run the mysql service baseurl=/usr/loca/app/mysql_13306 / / mysql binary program path with mysql user rights. Default is the. / bin/mysqlddataurl=/data/mysql_13306/ mysql database storage path of the current program. The default is / var/lib/mysql because we may put it in another location according to the security of our own data. You can delete the data directory in the binary and create a soft link to it. Then set the property of data to mysl.mysqlport=13306socket=/data/mysql_13306/mysql_13306.socket / / socket file, and the default path is / var/lib/mysql/mysql.sockpid-file=/var/run/mysql_13306.pid / / if not specified, then default to $datadir/ `hostname`.pid [mysqld _ safe] log-error=/var/log/mysql_13306.log
5. Start the server
Shell > bin/mysqld-- user=mysql & # or use mysqld_safeshell > bin/mysqld_safe-- user=mysql-- defaults-file=/usr/loca/app/mysql_13306/my.cnf & # it is officially recommended to use this # to start either mysqld or mysqld_safe. The simple difference is that mysqld_safe is more secure than mysql, because mysqld_safe monitors the status of the mysql service after startup to automatically restart the mysql service. In essence, the mysqld program is still used. # if the installation directory and database directory change, add relevant parameters
6. Add startup script.
# Next command is optionalshell > cp support-files/mysql.server / etc/init.d/mysql_13306.server if you modify the location of baseurl and dataurl, you need to assign values to these two variables. Here are the notes for mysqld_safe.
1. Different versions are installed differently. You need to refer to the official installation manual
2. To customize the path, you need to modify the relevant variables of the relevant files. Officially, the default path.
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.