In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to compile Mysql5.7.11 through Systemd. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
MySQL 5.7 main features:
Native support for better performance of Systemd: better optimization for multicore CPU, solid state drives, locks, better InnoDB storage engine, more robust replication: replication brings a solution that does not lose data at all, and traditional financial customers can also choose to use MySQL databases. In addition, the online smooth upgrade of GTID also makes it possible to be a better optimizer: the significance of optimizer code refactoring will bring huge improvements in this and later versions, and Oracle officials are solving the biggest problem before MySQL. Native JSON types support better geographic information service support: InnoDB natively supports geolocation types and supports GeoJSON GeoHash feature adds sys library: this will be the most frequently accessed library for DBA in the future. MySQL 5.7 has been added to the OneinStack-lnmp installation tool as a database option.
Install dependency packages
Yum-y install make gcc-c++ cmake bison-devel ncurses-devel
Download the mysql source code 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 for remote connection password] mysql > FLUSH PRIVILEGES; [refresh permission] these are all the contents of the article "how to compile Mysql5.7.11 through Systemd". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.
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.