Mysql service deployed in the linux environment

 

  Before downloading deployed several times, but every time step on some of the pit. The basic steps in deploying mounted mysql liunx hereby record:

1, uninstall the old version of mysql

  • find / -name mysql | xargs rm -rf      find and delete documents relating to mysql

2, can be downloaded by xftp mysql linux installation package uploaded to the server, to extract the / usr / the local directory

  • tar -zxvf mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz -C /usr/local   

3, first check whether there are mysql user and mysql user group, if there is no need to add a mysql user and mysql user group

  • mysql Groups      # check for mysql user and mysql user group, appeared the following picture to prove mysql user and mysql user group already exists.
  • mysql groupadd       # add mysql user group
  • -r -g mysql mysql useradd       # user add mysql

4, enter the mysql directory change permissions (to modify the current directory owned by mysql)

  • mysql cd /         # to enter the mysql directory
  • -R & lt mysql chown: mysql ./      # modify users and groups in the current directory is mysql

5, the installation script

  • ./scripts/mysql_install_db --user = mysql    script # perform the installation, the system error, the following specific visible images

  • Solution: install autoconf library
  • Command: yum the install autoconf -Y   # installed when this package is installed Data: Dumper module
  • After installing the library when autoconf, then run ./scripts/mysql_install_db --user = mysql, the following error may occur.
  • [root@iz2ze3g1c5ttso3f78zgo2z mysql]# ./scripts/mysql_install_db --user=mysql
    Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

  • If the above error, you need to check and install libaio.
  • -qa RPM | grep libaio      # check whether the installation libaio
  • yum -y install libaio-devel.x86_64  # 安装libaio
  • The last run again  ./scripts/mysql_install_db --user = MySQL , can be installed successfully. Specific seen pictures accessory

  • After installing modify the current directory owned by the root user, modify the data directory owned by mysql:
    1. chown -R root:root ./   
    2. chown -R mysql:mysql data

6, start mysql, mysql execute ./support-files/mysql.server start in the directory, but the system error. The reason is that log files without permission, we can modify the log file to point by changing the configuration, and creates a log file to troubleshoot

  • vim /etc/my.cnf
  • before fixing:

  • Modified:

  • Modify the content as follows:

[mysqld_safe]
log-error=/usr/local/mysql/logs/mysqld.log
pid-file=/var/run/mysql/mysql.pid

  • Create a log file, and modify the file permissions:

[root@iz2ze3g1c5ttso3f78zgo2z etc]# cd /usr/local/mysql/

[root@iz2ze3g1c5ttso3f78zgo2z mysql]# mkdir logs

[root@iz2ze3g1c5ttso3f78zgo2z mysql]# cd logs                                             

[root@iz2ze3g1c5ttso3f78zgo2z logs]# echo "" > /usr/local/mysql/logs/mysqld.log   

[root@iz2ze3g1c5ttso3f78zgo2z logs]# chown -R mysql:mysql /usr/local/mysql/logs/mysqld.log

[root@iz2ze3g1c5ttso3f78zgo2z logs]# cd /usr/local/mysql

[root@iz2ze3g1c5ttso3f78zgo2z mysql]# ./support-files/mysql.server start

 7, log in mysql, you can use this command to log  ./bin/mysql -h127.0.0.1 -uroot -p

8, after a successful login, you need to set the mysql password

  • . / Bin / mysqladmin -u root password 'root'   # is the root user password is set to "root"

After completion of setting, through the select user, host, password from mysql.user ;

 

May be the root user password in the host is also provided at the other, in this way (Update User password = PASSWORD SET ( "root") WHERE User = 'root'; ) the need to allow to change the password at: flush privileges; 

  • update user set password=passworD("root") where user='root';
  • flush privileges;

9, increasing remote access permissions, this time we can only log in mysql through the local machine, you can not log on remotely on other machines, but also wants permission to open telnet:

  • mysql> grant all privileges on *.* to root@'%' identified by 'root';
  • Query OK, 0 rows affected (0.00 sec)
  • mysql> flush privileges;
  • Query OK, 0 rows affected (0.00 sec)

10, using sqlyog deployed mysql connection service, check mysql can be remotely connected.

 

 


———————————————— 

Disclaimer: This article is the original article CSDN bloggers "rchm8519", following the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/rchm8519/article/details/84194562

Guess you like

Origin www.cnblogs.com/wanglle/p/11419065.html