標籤:
總結了一下網上MySQL 5.6.26 利用tar.gz包安裝的MysSQL資料庫會遇到的問題
安裝包:
Linux Generic
mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
安裝環境:
CentOS 7
這個資料庫照理說應該沒什麼難度,但是還是糾結了兩天。中文亂碼問題,資料庫服務restart報缺失.pid檔案問題。處理過程在這裡做個小的總結,以便以後工作中需要方便查閱。
1、建立mysql組和mysql使用者;
[[email protected] ~]# groupadd mysql
[[email protected] ~]# useradd -g mysql mysql
2、將擷取的tar.gz包解壓至/usr/local/目錄下;
[[email protected] ~]# tar -zxvf/data/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
[[email protected] ~]# cp /data/mysql-5.6.26-linux-glibc2.5-x86_64//usr/local/
3、改名,方便今後使用;
[[email protected] local]# mv mysql-5.6.26-linux-glibc2.5-x86_64/mysql/
4、修改mysql目錄的許可權;
[[email protected] local]# chown -R mysql:mysqlmysql
5、安裝;
[[email protected] mysql]# ./scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql--datadir=/usr/local/mysql/data
6、修改資料庫預設編碼;
[[email protected] mysql]# vi my.cnf
在[mysqld]後面加入
character_set_server=utf8
儲存退出
[[email protected] mysql]# cd support-files/
[[email protected] support-files]# vi my-default.cnf
同樣在[mysqld]後面加入
character_set_server=utf8
儲存退出
7、配置各種系統參數
[[email protected] support-files]# cp my-default.cnf /etc/my.cnf
[[email protected] support-files]# cp mysql.server/etc/rc.d/init.d/mysql
[[email protected] support-files]# vi /etc/profile 添加以下內容
export MYSQL_HOME="/usr/local/mysql" export PATH="$PATH:$MYSQL_HOME/bin" 儲存退出 [[email protected] support-files]# source /etc/profile
8、添加自啟動服務 [[email protected] support-files]# chkconfig --add mysql [[email protected] support-files]# chkconfig mysql on 9、啟動mysql [[email protected] support-files]# service mysql start 10、登入mysql及改密碼與配置遠端存取 [[email protected] support-files]# mysqladmin -u root password‘your_password‘ #修改root使用者密碼 [[email protected] support-files]# mysql -u root -p #登入mysql,需要輸入密碼 mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY‘your_password‘ WITH GRANT OPTION; #允許root使用者遠端存取 mysql>FLUSHPRIVILEGES; #重新整理許可權 mysql>exit
總結了一下網上MySQL 5.6.26 利用tar.gz包安裝的MysSQL資料庫會遇到的問題