centos7 php development environment installed -mysql

MySQL Installation

1. Install CMake ( as mysql installation tool )

      tar -zxvf cmake-3.8.0.tar.gz

     cd cmake-3.8.0

    ./bootstrap

    gmake

   gmake install

 2. Installation boost_1_59_0

      tar -zxvf boost_1_59_0.tar.gz

     cd boost_1_59_0

    ./bootstrap.sh

    ./b2

    ./b2 install

3. Create a user configuration directory

         Add mysql user and group belongs

         /usr/sbin/groupadd mysql

        /usr/sbin/useradd  -g mysql mysql

     Create a mysql installation directory and data directory

        mkdir /usr/local/mysql

        mkdir /usr/local/mysql/data

     Modify the mysql directory owner

        chown -R mysql:mysql /usr/local/mysql

4. Installation mysql

       tar -zxvf mysql-5.7.14.tar.gz

       cd mysql-5.7.14

       Copy the following text to

        cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data  -DDOWNLOAD_BOOST=1  -DWITH_BOOST=/usr/local/src/boost_1_59_0 -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1  -DWITHOUT_PARTITION_STORAGE_ENGINE=1  -DWITH_FAST_MUTEXES=1  -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1  -DWITH_READLINE=1  -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0

 

       make

      make install

      

5.mysql failure to recompile the installation, you need to remove the old object file and cache information

      make clean

     rm -f CMakeCache.txt

    rm -rf /etc/my.cnf

6. Configure mysql and initialize the database

       Profiles:

            cp /usr/local/mysql/support-files/my-default.cnf  /etc/my.cnf

       Initialize the database:

           ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

    Start mysql database

      /usr/local/mysql/bin/mysqld_safe -defaults-file=/etc/my.cnf -basedir=/usr/local/mysql  --datadir=/usr/local/mysql/data -user=mysql & ./--mysqld_safe --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql &

       Check whether to activate

      ps -ef | grep mysqld

     Softlinks:

     ln -s /usr/local/mysql/bin/mysql    /usr/bin

7. Modify the initialization code

        mysql  -u root  -p

       Set password = password('xxx');

       Alter user 'root'@'localhost' password expire never;

       grant all privileges on *.* to root@'%' identified by 'xxx';

      grant all privileges on *.* to 'root'@'%' identified by 'xxx' with grant option;

      Flush privileges;

 

8. boot

  1. touch /usr/lib/systemd/system/mysql.service

         2. Set content

        

[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
#Restart=on-failure
#RestartPreventExitStatus=1
#PrivateTmp=false

9. Operation     

        systemctl start mysql

       systemctl stop mysql

      systemctl restart mysql

       systemctl disable mysql

       systemctl enable mysql

       systemctl status mysql

  

Guess you like

Origin www.cnblogs.com/ddf128/p/12123837.html