這篇文章主要介紹了關於linux編譯安裝mysql5.7,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
useradd -s /usr/sbin/nologin -r mysql
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.21.tar.gz tar -zxf mysql-boost-5.7.21.tar.gz cd mysql-5.7.21
yum remove mariadb-libs yum install gcc -y yum install gcc-c++ -y yum install cmake -y yum install libaio -y yum install ncurses-devel -y
mkdir -p /data/db/mysql mkdir -p /data/log/mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DSYSCONFDIR=/usr/local/mysql/etc \ -DMYSQL_DATADIR=/data/mysql \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_SYSTEMD=1 \ -DWITH_SSL=system \ -DWITH_ZLIB=system \ -DWITH_EMBEDDED_SERVER=1 \ -DENABLED_LOCAL_INFILE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/usr/local/boost make -j8 && make install
[root@root mysql-5.7.12]# cd /usr/local/mysql/ [root@root mysql]# ls bin data include man mysql.sock.lock README support-files COPYING docs lib mysql.sock mysql-test share
mkdir -p /data/db/mysql/ mkdir -p /data/log/mysql/
mkdir /usr/local/mysql/etc touch /usr/local/mysql/etc/my.cnf ln -s /usr/local/mysql/etc/my.cnf /usr/local/etc
chown -R mysql:mysql /usr/local/mysql/* chown -R mysql:mysql /data/db/mysql /data/log/mysql
cd /usr/local/mysql bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/db/mysql bin/mysql_ssl_rsa_setup vim /data/log/mysql/error.log 查看初始化密码 grep 'temporary password' /data/log/mysql/error.log
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system mkdir -p /var/run/mysqld/ chown mysql:mysql /var/run/mysqld systemctl start mysqld service mysql start
service mysqld start 检查mysql启动是否正常 service mysqld status 或者 ps -ef | grep mysql 设置mysqld服务开机自启动 systemctl enable mysqld.service 检查mysqld开机自启动是否设置成功 systemctl list-dependencies | grep mysqld
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Studytime%'; use mysql; select host, user from user; update user set host = '%' where user = 'root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Studytime%' WITH GRANT OPTION; FLUSH PRIVILEGES;
以上就是本文的全部內容,希望對大家的學習有所幫助,更多相關內容請關注PHP中文網!
相關推薦:
以上是linux編譯安裝mysql5.7的詳細內容。更多資訊請關注PHP中文網其他相關文章!