CentOS 7 + MySQL

來源:互聯網
上載者:User

標籤:mysql

環境: CentOS7 

軟體:MySQL5.6.26

1 下載MySQL 源碼包

wget http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.10/zabbix-2.2.10.tar.gz

2 解壓下載的檔案到/usr/local目錄並修改檔案夾名稱為mysql

tar -zxvf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz  -C /usr/localmv mysql-5.6.26-linux-glibc2.5-x86_64/ mysql

3建立Mysql使用者和使用者組

useradd mysql -s /sbin/nologin

4建立Mysql資料庫目錄並賦予許可權給Mysql使用者

mkdir -p /data/mysqlchown -R mysql:mysql /data/mysqlchown -R mysql:mysql /usr/local/mysql

5進入/usr/local/mysql目錄 初始化mysql

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

6 備份系統內建的my.cnf檔案,然後把Mysql解壓目錄中預設設定檔移過去

mv /etc/my.cnf /etc/my.cnf.bakcp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

7修改my.cnf檔案

datadir=/data/mysqlport=3306socket=/tmp/mysql.sock

8複製解壓目錄下面的mysql.server檔案到/etc/init.d/mysqld

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqldchmod 755 /etc/init.d/mysqldvi /etc/init.d/mysqlddatadir=/data/mysql   #修改資料庫目錄檔案

9 啟動mysql服務

service mysqld startUsage: mysqld  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

10 配置mysql的環境變數

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profilesource /etc/profile

11 登入mysql

[[email protected] ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.26 MySQL Community Server (GPL)Copyright (c) 2000, 2015, 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>

安裝完成

本文出自 “站在巨人的肩膀上看世界” 部落格,請務必保留此出處http://lixiaotao.blog.51cto.com/985722/1692864

CentOS 7 + 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.