CentOS7 64位安裝mysql5.7(linux)
1 首先安裝完成jdk,方法如上一篇文章
如果wget命令無效則輸入如下指令安裝(command not found):
yum -y install wget
2 安裝mysql -yum源,可以自己下載,下載地址(百度搜尋mysql yum源):
https://dev.mysql.com/downloads/repo/yum/
下載完成後可以透過遠端軟體傳到linux資料夾中,也可以用wget自行在linux環境下載
3 安裝yum源,輸入命令
[root@localhost soft]# yum localinstall mysql57-community-release-el7-11.noarch.rpm
已載入外掛:fastestmirror
正在檢查 mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
mysql57-community-release-el7-11.noarch.rpm 將被安裝
正在解決依賴關係
--> 正在檢查事務
---> 軟體包 mysql57-community-release.noarch.0.el7-11 將被 安裝
--> 解決依賴關係完成
依賴關係解決
================================================================================
Package 架構 版本 源 大小
================================================================================
正在安裝:
mysql57-community-release
noarch el7-11 /mysql57-community-release-el7-11.noarch 31 k
事務概要
================================================================================
安裝 1 軟體包
總計:31 k
安裝大小:31 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : mysql57-community-release-el7-11.noarch 1/1
驗證中 : mysql57-community-release-el7-11.noarch 1/1
已安裝:
mysql57-community-release.noarch 0:el7-11
完畢!
4 下載並安裝mysql,輸入命令,看到如下圖
a. 安裝之前可以輸入如下命令,檢查yum源是否安裝成功
yum repolist enabled | grep "mysql.*-community.*"
b.輸入如下命令開始安裝yum install mysql-community-server
5. 啟動mysql
service mysqld start //啟動mysql
chkconfig --add mysqld //加入系統服務
chkconfig mysqld on //開機自動啟動
systemctl start mysqld #啟動mysql
systemctl enable mysqld #設定開機啟動
systemctl daemon-reload
6.登入mysql
mysql安裝成功後會生成一個隨機密碼,存放在/var/log/mysqld.log
grep 'temporary password' /var/log/mysqld.log
2017-06-13T14:30:34.802886Z 1 [Note] A temporary password is generated for root@localhost: dsA&abJxe7Ju
mysql -uroot -p #輸入上面獲取到的初始密碼進入mysql修改密碼
開啟找到密碼並登陸
set password = password('root')
如果不允許設定簡單密碼,則輸入這兩句,第一句表示可以設定純數字或字母,第二句表示密碼長度最低4位
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.01 sec)
set password=password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)
7.開啟 允許mysql遠端登入(mysql預設只能本地登入)
登入mysql後輸入如下命令
mysql> grant all privileges on *.* to 'root' @'%' identified by 'root';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
8.開啟Linux 3306對外訪問的埠
[root@localhost /]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@localhost /]# /etc/rc.d/init.d/iptables save #將設定儲存到防火牆內
9.配置預設編碼為UTF-8
修改/etc/my.cnf檔案,在[mysqld]下面配置:
[mysqld]
character_se_server=utf8
init_connect='SET NAMES utf8'
也可以在mysql視窗內輸入:
- mysql> SET character_set_client = utf8 ;
- mysql> SET character_set_connection = utf8 ;
- mysql> SET character_set_database = utf8 ;
- mysql> SET character_set_results = utf8 ;
- mysql> SET character_set_server = utf8 ;
- mysql> SET collation_connection = utf8 ;
- mysql> SET collation_database = utf8 ;
- mysql> SET collation_server = utf8
10.嘗試遠端連線,完成mysql安裝
相關文章
- CentOS7 安裝mysql5.7CentOSMySql
- mysql5.7安裝_centos7MySqlCentOS
- CentOS7 yum安裝MySQL5.7CentOSMySql
- centos7安裝mysql5.7 使用yumCentOSMySql
- CentOS7利用docker安裝MySQL5.7CentOSDockerMySql
- Centos7下安裝配置MySQL5.7CentOSMySql
- 在centos7上安裝mysql5.7CentOSMySql
- CentOS7 透過YUM安裝MySQL5.7CentOSMySql
- CentOS7下MySQL5.7安裝與配置(YUM)CentOSMySql
- centos7安裝mysql5.7解壓縮版CentOSMySql
- linux離線安裝mysql5.7LinuxMySql
- Centos7系統如何安裝MySQL5.7資料庫?CentOSMySql資料庫
- CentOS7 64位下MySQL5.7安裝與配置(YUM)CentOSMySql
- MySQL5.7 linux二進位制安裝MySqlLinux
- Linux-Redis安裝(CentOS7)LinuxRedisCentOS
- Centos7安裝Mysql5.7 提示GPG 金鑰不存在/不合適CentOSMySql
- Centos7安裝Mysql5.7方法總結 - 實操手冊CentOSMySql
- mysql5.7 安裝教程MySql
- centos安裝mysql5.7CentOSMySql
- (Linux)CentOS7下安裝JDK 1.8LinuxCentOSJDK
- 騰訊雲centos7安裝mysql5.7,並開啟3306埠CentOSMySql
- Windows安裝MySQL5.7教程WindowsMySql
- Linux下Centos7以rpm方式離線安裝MySQL5.7教程以及部分報錯解決方案LinuxCentOSMySql
- 阿里雲centos7[linux]安裝nginx阿里CentOSLinuxNginx
- linux(麒麟 centos7)安裝7zLinuxCentOS
- Linux(Centos7)安裝Docker 社群(ce)版LinuxCentOSDocker
- 基於Linux的MySQL5.7原始碼編譯安裝LinuxMySql原始碼編譯
- Centos7安裝安裝部署dockerCentOSDocker
- CentOS7.3 安裝 MySQL5.7CentOSMySql
- MySQL5.7綠色版安裝MySql
- ubuntu16 安裝mysql5.7UbuntuMySql
- windows安裝及配置mysql5.7WindowsMySql
- 基於centos7的MySQL5.7二進位制安裝包的本地升級CentOSMySql
- MySQL:mysql5.7解壓版安裝與解除安裝MySql
- Linux(CentOS7)安裝最新版PythonLinuxCentOSPython
- centos7 安裝ssh擴充套件控制linuxCentOS套件Linux
- 基於Linux的MySQL5.7的二進位制安裝LinuxMySql
- 安裝centos7最小化安裝CentOS