溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL如何部署在Linux上

發(fā)布時間:2022-01-14 15:41:40 來源:億速云 閱讀:259 作者:小新 欄目:MySQL數(shù)據(jù)庫

這篇文章給大家分享的是有關MySQL如何部署在Linux上的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

配置SQL
1.用yum從windows下載SQL包到Linux
命令rz 找到SQL的tar包 上傳MySQL如何部署在Linux上
2.檢查是否安裝好
通過檢查進程ps -ef|grep mysqldMySQL如何部署在Linux上
通過檢查是否存在 rpm -qa|grep -i mysqldMySQL如何部署在Linux上
3.安裝和改名
tar安裝tar包 tar -xzvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
mv改名字   mv mysql-5.6.23-linux-glibc2.5-x86_64 mysql
4.創(chuàng)建用戶和用戶組
MySQL如何部署在Linux上
5.為了以下步驟配置個人環(huán)境變量
[root@sht-sgmhadoopnn-01 local]# cp /etc/skel/.* /usr/local/mysql  
cp: omitting directory `/etc/skel/.'
cp: omitting directory `/etc/skel/..'
cp: omitting directory `/etc/skel/.mozilla'MySQL如何部署在Linux上
6.創(chuàng)建/etc/my.cnf
用vi命令創(chuàng)建 vi /etc/my.cnf 然后gg進入首行,dG清空文件內容,復制粘貼進去配置內容(記得要進入insert)MySQL如何部署在Linux上



7.改變my.cnf文件的用戶,用戶組和權限
使用chown改變文件的使用用戶和用戶組
使用chomd改變文件的權限MySQL如何部署在Linux上



8.改變文件夾/usr/local/mysql的用戶,用戶組和權限
MySQL如何部署在Linux上



9.第一次安裝
輸入指令scripts/mysql_install_db  --user=mysqladmin --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data  如圖:MySQL如何部署在Linux上


10.將文件拷貝到ini.d,并重命名
cp support-files/mysql.server /etc/rc.d/init.d/mysql 如圖:MySQL如何部署在Linux上

11.賦予可執(zhí)行權限
chmod +x /etc/rc.d/init.d/mysqlMySQL如何部署在Linux上


12.添加服務
chkconfig --add mysql


13.設置權限
chkconfig --level 345 mysql on

14.修改內容
vi /etc/rc.local:<ol start="1"  white-space:normal;"="">

  • #!/bin/sh  

  • #  

  • # This script will be executed *after* all the other init scripts.  

  • # You can put your own initialization stuff in here if you don't  

  • # want to do the full Sys V style init stuff.  

  •   

  •   

  • touch /var/lock/subsys/local  

  •   

  • su - mysqladmin -c "/etc/init.d/mysql start --federated"


  • 15.檢查mysql狀態(tài)


  • service mysql status



  • MySQL如何部署在Linux上


感謝各位的閱讀!關于“MySQL如何部署在Linux上”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。

AI