In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Systemd to compile Mysql5.7.11 under Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Systemd is a Linux system tool used to start daemons and has become standard in most distributions.
Install the dependency package yum-y install make gcc-c++ cmake bison-devel ncurses-devel download the mysql source package
There are two versions of the source package: mysql-5.7.11.tar.gz does not come with the boost library and needs to be downloaded by yourself.
Mysql-boost-5.7.11.tar.gz comes with a boost library. It is recommended to download it in the decompressed root directory. Wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.11.tar.gz
Curl-O http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-5.7.11.tar.gz
Tar-zxf mysql-boost-5.7.11.tar.gz
Cd mysql-5.7.11
Compile
Generate makefile "
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\-DMYSQL_TCP_PORT=3306\-DENABLED_LOCAL_INFILE=1\-DWITH_PARTITION_STORAGE_ENGINE=1\-DEXTRA_CHARSETS=all\-DDEFAULT_CHARSET=utf8\ [character set]-DDEFAULT_COLLATION=utf8_general_ci\ [collation must have Otherwise, it is difficult to initialize the database]-DDOWNLOAD_BOOST=1\ [Boost library is required from MySQL 5.7.5]-DWITH_BOOST=/root/mysql-5.7.11/boost\-DWITH_SYSTEMD=1 [supports Systemd] plus-DWITH_SYSTEMD=1 can use systemd to control the mysql service. Systemd is not enabled by default.
Then make-j 2 & & make install mysql will be installed in the / usr/local/mysql path and so on.
Configure MySQL
Add mysql users and groups
Groupadd mysql
Useradd-g mysql-s / sbin/nologin mysql
Modify / usr/local/mysql permissions
Chown-R mysql:mysql / usr/local/mysql
Create a mysql PID default directory
In mysqld.service, the default pid file is assigned to the / var/run/mysqld/ directory without creating the directory in advance, so create the directory manually and assign permissions to the mysql user. Mkdir-p / var/run/mysqldchown mysql:mysql / var/run/mysqld
Default location of three running files for mysql
Log: / var/log/mysqld.logpid: / var/run/mysqld/mysqld.pidsock: / tmp/mysql.sock
Copy my.cnf and mysqld.service
Cp support-files/my-default.cnf / etc/my.cnf
Mysql 5.7 installs the mysqld.service (/ usr/local/mysql/) file to usr/lib/systemd/system/, under the mysql installation directory by default and copies mysqld.service to the / usr/lib/systemd/system/ directory [root@localhost] / usr/local/mysql#cp usr/lib/systemd/system/mysqld.service / usr/lib/systemd/system
Add environment variabl
-Edit / etc/profile file and add the following two lines at the end-"
Vim / etc/profile
PATH=/usr/local/mysql/bin:$PATH export PATH
Source / etc/profile
Initialize a password-less mysql database
Bin/mysqld-- initialize-insecure-- user=mysql-- basedir=/usr/local/mysql-- datadir=/usr/local/mysql/databin/mysql_ssl_rsa_setup appears the following content, initializing successfully 2016-02-22T03:56:27.254356Z 1 [Warning] root@localhost is created with an empty password! Please consider switching off the-initialize-insecure option.
-- initialize generates a random password (saved in ~ / .mysql_secret), while-- initialize-insecure does not generate a password. When setting a password in the MySQL Security configuration Wizard mysql_secure_installation, you are free to choose the mysql password level.
-- there can be no data files in the target directory of datadir.
The previous version of the initializer mysql_install_db is under / usr/local/mysql/script and will be removed in the future, replacing the obsolete mysql5.7 with mysqld in the / usr/local/mysql/bin directory.
Start mysql
Systemctl start mysqld.service
Systemctl status mysqld.service
Run the MySQL Security configuration Wizard mysql_secure_installation to set the password before the mysql service is started
A) set password for root user b) delete anonymous account c) cancel remote login of root user d) delete test library and access to test library e) refresh authorization table to make the modification effective [root@localhost mysql] # mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password. [connect to MySQL with an empty password]
VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? [the VALIDATE password plug-in can be used to test passwords and improve security. Do you want to set up the VALIDATE password plugin?]
Press y | Y for Yes, any other key for No: y
There are three levels of password validation policy: [there are three levels of password authentication policies:]
LOW Length > = 8 MEDIUM Length > = 8, numeric, mixed case, and special characters STRONG Length > = 8, numeric, mixed case, special characters and dictionary file [minimum length > = 8 medium length > = 8, number, mixed case and special character maximum length > = 8, number, mixed case, special character and dictionary file]
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 [enter 0 = low, 1 = medium 2 = strong: 0] Please set the password for root here. [please set the password for the root user here.]
New password: [new password:]
Re-enter new password: [re-enter the new password:]
Estimated strength of the password: 25 [estimated strength of password: 25] Do you wish to continue with the password provided? (Press y | Y for Yes, any other key for No): y [do you want to continue with the password provided (press y | Y for yes, because there are no other keys): y?] ... Failed! Error: Your password does not satisfy the current policy requirements [… Failure! Error: your password does not meet the current requirements]
New password:
Re-enter new password:
Estimated strength of the password: 50 [estimated strength of password: 50] Do you wish to continue with the password provided? (Press y | Y for Yes, any other key for No): y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. [by default, MySQL installs an anonymous user that allows anyone to log in to MySQL.]
Remove anonymous users? (Press y | Y for Yes, any other key for No): y [delete anonymous users?] Success. [success.]
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. [in general, Root only allows it to make a 'localhost' (local) connection.]
Disallow root login remotely? (Press y | Y for Yes, any other key for No): n [disable remote root login?]
... Skipping. [... Skip.] By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. By default, MySQL comes with a database called Test, which anyone can access. This is also for testing only and should be moved to the environment that was deleted before production.]
Remove test database and access to it? (Press y | Y for Yes, any other key for No): n [delete test database and access permissions?]
... Skipping. [... Skip.] Reloading the privilege tables will ensure that all changes made so far will take effect immediately. [refresh the authorization table to ensure that all changes will take effect immediately.]
Reload privilege tables now? (Press y | Y for Yes, any other key for No): [refresh authorization table now?]
... Skipping. All done! [all done!]
Open Root remote connection permissions
Mysql-u root-pmysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' password' WITH GRANT OPTION; [password is remote connection password] mysql > FLUSH PRIVILEGES; [refresh permission]
This is the end of this article on "how to compile Mysql5.7.11 with Systemd under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.