Linux Centos7安裝MySQL5.5(二進位方式安裝)

來源:互聯網
上載者:User

標籤:MySQL5.5

Linux Centos7安裝MySQL5.5(二進位方式安裝)一、在/app目錄下下載mysql-5.5.54-linux2.6-x86_64.tar.gz`
[[email protected] /]# cd /app[[email protected] app]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.54-linux2.6-x86_64.tar.gz
二、解壓mysql-5.5.54-linux2.6-x86_64.tar.gz

[[email protected] app]# ta zvxf mysql-5.5.54-linux2.6-x86_64.tar.gz

三、將解壓後的mysql-5.5.54-linux2.6-x86_64改名為mysql

[[email protected] app]# mv mysql-5.5.54-linux2.6-x86_64 mysql

四、添加/etc/my.cnf檔案
[[email protected] app]# cd /app/mysql/support-files/[[email protected] support-files]# cp -f my-small.cnf /etc/my.cnf
五、建立mysql目錄下的data目錄
[[email protected] support-files]# mkdir -p /app/mysql/data/
六、將mysql的所屬使用者改為mysql
[[email protected] support-files]# chown -R mysql.mysql /app/mysql/
七、增加/etc/init.d/mysqld,並為之賦予執行許可權,然後初始化MySQL
[[email protected] support-files]# cp -f mysql.server /etc/init.d/mysqld[[email protected] support-files]# chmod +x /etc/init.d/mysqld

【初始化MySQL】

[[email protected] support-files]# /app/mysql/scripts/mysql_install_db --basedir=/app/mysql --datadir=/app/mysql/data --user=mysql
八、將 /application/mysql/bin/mysqld_safe和/etc/init.d/mysqld中的/usr/local/mysql改為/app/mysq
[[email protected] support-files]# sed -i ‘s#/usr/local/mysql#/app/mysql#g‘ /app/mysql/bin/mysqld_safe /etc/init.d/mysqld
九、啟動mysql
[[email protected] support-files]# /etc/init.d/mysqld startStarting MySQL.Logging to ‘/app/mysql/data/test.err‘... SUCCESS! 
十、檢查mysql是否啟動
[[email protected] support-files]# netstat -lntup | grep mysqltcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      5478/mysqld 
十一、設定環境變數
[[email protected] support-files]# echo ‘export PATH=/app/mysql/bin:$PATH‘ >>/etc/profile[[email protected] support-files]# source /etc/profile
十二、進入mysql
[[email protected] support-files]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.54 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> 
十三、修改root密碼
mysql> SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘newpass‘);
十四、退出MySQL,使用使用者名稱和密碼再次登入MySQL
mysql> Ctrl-C -- exit!Aborted[[email protected] support-files]# mysql -uroot -pEnter password: 
十五、匯入sql檔案(若需要執行此步驟)
mysql> source /app/cloud_note.sqlmysql> show databases;

Linux Centos7安裝MySQL5.5(二進位方式安裝)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.