About linux-Centos 7 mysql 5.7.9 rpm package installation), linux-centos5.7.9

Source: Internet
Author: User

About linux-Centos 7 mysql 5.7.9 rpm package installation (conversion), linux-centos5.7.9

Operating System: Centos 7.1

Mysql database version: mysql5.7.9

Mysql Official Website: http://www.mysql.com

------------------------------------------

1. Before installing the new mysql version, we need to uninstall the mariadb-lib that comes with the system.

[root@5201351 ~]# rpm -qa|grep mariadbmariadb-libs-5.5.41-2.el7_0.x86_64[root@5201351 ~]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64 --nodeps

2, to the mysql official website to download the latest mysql rpm collection package: mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar

3. Upload mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar to the linux server and decompress the tar package.

4. to install the mysql-server service, you only need to install the following four software packages. You can run the rpm-ivh command to install the service.

Mysql-community-common-5.7.9-1.el7.x86_64.rpm
Mysql-community-libs-5.7.9-1.el7.x86_64.rpm -- (depending on common)
Mysql-community-client-5.7.9-1.el7.x86_64.rpm -- (dependent on libs)
Mysql-community-server-5.7.9-1.el7.x86_64.rpm -- (dependent on client, common)

5. The next step is to initialize the database. We can use the following commands to achieve the same effect.

[Root @ 5201351 ~] # Mysql_install_db -- datadir =/var/lib/mysql // datadir must be specified. After execution ~ /. Mysql_secret Password File [root @ 5201351 ~] # Mysqld -- initialize // This method is recommended for the new version. The execution will generate a random password in/var/log/mysqld. log

6. Change the user and group of the mysql database directory, and then start the mysql database

[Root @ 5201351 ~] # Chown mysql: mysql/var/lib/mysql-R [root @ 5201351 ~] # Systemctl start mysqld. service // start mysql Database service

7. log on to mysql according to the password in step 1 and change the password of the root user. The new mysql version cannot execute any command before changing the password after the first login.

[root@5201351 ~]# mysql -uroot -p')j#)=uRig4yJ'mysql> set password=password('www.cnblogs.com/5201351');

8. Finally, we can create users and assign permissions based on actual conditions.

mysql> create user 'root'@'192.168.100.2' identified by 'QQ5201351'; mysql> GRANT ALL PRIVILEGES ON dbname.* to 'root'@'192.168.100.2';mysql> flush privileges

========================================================== ======

Note that the Password field is no longer in the user table of the new mysql database,

Instead, the encrypted user password is stored inAuthentication_stringField

 

Respect others' labor results reprinted please be sure to indicate the source: http://www.cnblogs.com/5201351/p/4912614.html

Http://www.cnblogs.com/5201351/p/4912614.html

 

After installing mysql, you will always be prompted no matter whether you run any command after logging on.

Step 1: set password = PASSWORD ('your new password ');
Or update user set authentication_string = password ("your_new_password") where user = "root ";

Step 2: alter user 'root' @ 'localhost' password expire never;

Step 3: flush privileges;

After completing the three steps above, log on again and use the new password. In addition to changing the new password in red, enter the new password as is.

Reference 1: https://dev.mysql.com/doc/refman/5.6/en/alter-user.html

Reference 2: http://dev.mysql.com/doc/refman/5.7/en/password-expiration-policy.html

Reference 3: http://stackoverflow.com/questions/33467337/reset-mysql-root-password-using-alter-user-statement-after-install-on-mac

Http://www.cnblogs.com/debmzhang/p/5013540.html

 

CentOS 7 inherits New Features of RHEL 7, such as powerful systemctl. The use of systemctl also makes the/etc/init of system services in the past. d's startup script method has changed, greatly improving the operating efficiency of system services. However, the service configuration is significantly different from the previous one. To be honest, it is much simpler and easier to use.

The following example describes how to use forever to implement automatic startup of Node. js project and how to use systemctl of CentOS 7.

Prerequisites: The Node. js environment has been configured successfully. After the forever package is successfully installed, a Node. js program can be run.

The systemctl script of the CentOS 7 service is stored in:/usr/lib/systemd/. There are systems and users, such as programs that can be run without logon, there is still a system service, that is, under the/usr/lib/systemd/system directory.

Each service. the end of a service is generally divided into three parts: [Unit], [Service], and [Install]. The service I wrote is used to start a Node. js project, details:

[Unit]
Description = xiyoulibapi
Afterappsnetwork.tar get remote-fs.target nss-lookup.target
 
[Service]
Type = forking
PIDFile =/node. js/pid
ExecStart =/usr/local/bin/forever start/node. js/xiyoulib/bin/www
ExecReload =/usr/local/bin/forever restart/node. js/xiyoulib/bin/www
ExecStop =/usr/local/bin/forever stop/node. js/xiyoulib/bin/www
PrivateTmp = true
 
[Install]
Wantedbypolicmulti-user.tar get

The [Unit] section mainly describes the service, including Description and After. Description is used to describe the service, and After is used to describe the service category.

[Service] is the key of the Service and the setting of some specific running parameters of the Service. Here, Type = forking is the form of running in the background, and PIDFile is the file path for storing the PID, execStart is the specific running command of the service, ExecReload is the restart command, ExecStop is the Stop command, and PrivateTmp = True indicates that the service is allocated an independent temporary space. Note: the absolute path is required for all the commands for starting, restarting, and stopping [Service]. An error is returned if the relative path is used!

[Install] is related to the service installation settings, which can be set to multiple users.

After the service script is compiled as above, it is saved in the/usr/lib/systemd/system directory with 754 permissions. Then you can use systemctl for configuration.

First, use systemctl start [service name (also file name)] to test whether the service can run successfully. If it cannot run, use systemctl status [service name (also file name)] view the error information and other service information, and modify the information based on the error report until start is available. If you are not at ease, you can test the restart and stop commands.

Then, you only need to use systemctl enable xxxxx to add the Written service to the on-premises startup.

The Compiling Method of my script is based on the compiling method of nginx, or similar programs with other functions.

In this case, although systemctl is unfamiliar, it is actually better than init. d. That method is much simpler and easier to use. There are still many operations that can be simplified by systemctl. Now there are a lot of information. It seems that RHEL/CentOS is more advanced than other Linux releases, this update finally abandoned the Linux 2.6 kernel, improving both speed and stability.

Http://www.linuxidc.com/Linux/2014-07/104487.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.