您好,登錄后才能下訂單哦!
這篇文章主要介紹centos7環境下二進制安裝包怎么安裝mysql5.6,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
本文實例講述了centos7環境下二進制安裝包安裝 mysql5.6的方法。分享給大家供大家參考,具體如下:
centos7 二進制安裝包安裝 mysql5.6
一、下載mysql5.6二進制安裝包
http://mirrors.sohu.com/mysql/MySQL-5.6/
如:mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
二、安裝mysql5.6(安裝在/data/mysql56)
(1)、創建mysql用戶賬號
> useradd -s /sbin/nologin -M mysql
(2)、解壓壓縮包
> tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
(3)、重命名
> mv mysql-5.6.34-linux-glibc2.5-x86_64 mysql56
(4)、復制配置文件
> cp /data/mysql56/support-files/my-default.cnf /etc/my.cnf
修改配置文件
[client] port = 3306 socket = /data/mysql56/mysql.sock default-character-set = utf8 [mysqld] skip-name-resolve user = mysql basedir = /data/mysql56 datadir = /data/mysql56/data port = 3306 server_id = 10 socket = /data/mysql56/mysql.sock pid-file = /data/mysql56/mysql.pid log-error = /data/mysql56/data/mysql.err log-bin = /data/mysql56/data/mysql-bin character-set-server = utf8
(*二進制安裝,默認配置文件在/etc/my.cnf)
(5)、初始化數據庫
> chown -R mysql.mysql /data/mysq56 > /data/mysql56/scripts/mysql_install_db \ --defaults-file=/etc/my.cnf \ --user=mysql \ --basedir=/data/mysql56 \ --datadir=/data/mysql56/data
如果出現如下信息
FATAL ERROR: please install the following Perl modules before executing
Data::Dumper
> yum -y install autoconf
此包安裝時會安裝Data:Dumper模塊
三、配置并啟動mysql
> cp /data/mysql56/support-files/mysql.server /etc/init.d/mysqld > chmod 755 /etc/init.d/mysqld
(*注意,mysql二進制安裝默認的路徑為/usr/local/mysql,啟動腳本里/usr/local/mysql需要替換)
> sed -i 's#/usr/local/mysql#/data/mysql56#g' /data/mysql56/bin/mysqld_safe /etc/init.d/mysqld
啟動mysql
> service mysqld start
四、添加自啟動
> chkconfig --add mysqld > chkconfig mysqld on > chkconfig --list mysqld
五、配置環境變量
> echo 'export PATH=/data/mysql56/bin:$PATH' >> /etc/profile > source /etc/profile
六、修改mysql密碼(mysql5.6安裝默認root密碼為空)
> mysqladmin -u root password '123456'
七、清理無用的mysql用戶及庫
登陸mysql
> mysql -uroot -p
查詢用戶
> select user,host from mysql.user;
如下所示
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | localhost.localdomain |
| root | localhost.localdomain |
+------+-----------------------+
> drop user "root"@"::1"; > drop user ""@"localhost"; > drop user ""@"localhost.localdomain"; > drop user "root"@"localhost.localdomain";
刪除無用庫
> drop database test;
以上是“centos7環境下二進制安裝包怎么安裝mysql5.6”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。