linux 安裝mysql

來源:互聯網
上載者:User

標籤:.so   bin   /etc   home   安裝   data   ble   efault   usr   

1.安裝mysql5.6依存包[[email protected] src]# yum -y install make gcc-c++ cmake bison-devel ncurses-devel libaio[[email protected] src]# yum install libaio libaio-devel -y[[email protected] src]# yum install net-tools -y2.下載編譯包wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.37-linux-glibc2.12-x86_64.tar.gztar -xvf mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz3.複製到指定目錄mv mysql-5.6.37-linux-glibc2.12-x86_64 /usr/local/mysql4.建立mysql使用者和組groupadd mysqluseradd -r -g mysql mysql -d /usr/local/mysqlpasswd mysql5.修改目錄許可權chown -R mysql:mysql /usr/local/mysql6.安裝資料庫su mysql/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dataexit7.複製mysql設定檔cd /usr/local/mysql/support-filescp my-default.cnf /etc/my.cnf8.添加系統服務cp mysql.server /etc/init.d/mysqlchkconfig mysql on9.添加環境變數vim /etc/profile在最下面添加export MYSQL_HOME="/usr/local/mysql"export PATH="$PATH:$MYSQL_HOME/bin"儲存退出後,執行生效代碼. /etc/profile10.啟動mysqlservice mysql start11.設定root密碼mysqladmin -u root password ‘123456‘12.設定預設連接埠vi /etc/my.cnf[mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/dataport=3306server_id=1socket=/tmp/mysql.sockmax_allowed_packet=4M13.允許所有外部連結訪問(可選)mysql -u root -pmysql命令列輸入GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;FLUSH PRIVILEGES;14.關閉防火牆chkconfig iptables offservice iptables stop  

linux 安裝mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.