mysql 5.6.34.rpm_离线安装mysql5.6及依赖_centos7离线安装mysql5.6.34
Centos7將默認數據庫mysql替換成了Mariadb,安裝沒那么方便了。
如果用yum還容易些,改改下載源,上網就可以安裝。
離線的話,先去下載一個安裝包,我下載的是mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz,
還可以下載到。
安裝的時候需要用到perl-Data-Dumper.x86_64,不然會出錯誤提示
FATAL ERROR: please install the following Perl modules before executing
/usr/local/mysql/scripts/mysql_install_db:Data::Dumper
可以自己下載,不大,45K就上傳到這里,文章最下面有下載鏈接。
這里也有
安裝的centos7是64位,不要選默認的最小安裝,不然perl的插件就沒有,選基本網絡就好,不過還是沒有perl-Data-Dumper.x86_64。
選基本網絡模式安裝,mariadb就自動進來了,需要刪除掉。
rpm -qa | grep mariadb
看一下是不是有,如果有都刪掉。
rpm -e --nodeps 列表里面的項目
上傳從這里下載的perl-Data-Dumper并安裝
rpm -ivh perl-Data-Dumper-2.145-3.el7.x86_64.rpm
新安裝的機器應該沒有/etc/my.cnf,不過保險起見,還是看看,有刪了。
建立組和用戶
groupadd mysql
useradd -g mysql mysql
把下載的安裝包上傳到/usr/local/
展開
tar -zxvf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
把展開的目錄改成mysql
mv mysql-5.6.34-linux-glibc2.5-x86_64 mysql
自己產生一個、etc/my.cnf
內容:
[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
[mysqld]
skip-name-resolve
port = 3306
socket=/var/lib/mysql/mysql.sock
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M
把mysql文件夾所有者修改為mysql用戶和組
cd /usr/local/mysql
chown -R mysql:mysql ./
開始安裝
./scripts/mysql_install_db --user=mysql
在修改一下data目錄的所有權
chown -R mysql:mysql data
制作啟動連接
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
加執行權
chmod +x /etc/rc.d/init.d/mysqld
做成自動服務
chkconfig --add mysqld
確認一下
chkconfig --list mysqld
啟動
service mysqld start
查看狀態
service mysqld status
SUCCESS! MySQL running (10832)
編輯/etc/profile文件,加入環境變量,把這樣一行加進入
export PATH=$PATH:/usr/local/mysql/bin
立刻生效
. /etc/profile
試一試
mysql -u root
Welcome to the MySQL monitor.? Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
不要帶-p,會提示要輸入密碼,輸啥肯定是個死啊,還沒配置呢,不過好像直接回車也行。
下面修改密碼
mysql> use mysql
mysql> update user set password=password('shen_xu123') where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1? Changed: 1? Warnings: 0
讓遠程可以訪問
GRANT ALL PRIVILEGES ON *.* TO 'your username'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;
'your username'和'your password'自行修改
總結
以上是生活随笔為你收集整理的mysql 5.6.34.rpm_离线安装mysql5.6及依赖_centos7离线安装mysql5.6.34的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿里云安装mysql5.6_yum安装m
- 下一篇: python定义一个类和子类_Pytho