Linux WEB伺服器搭建-MySql篇

來源:互聯網
上載者:User

標籤:mysql安裝 lamp

採用源碼安裝,可以根據實際生產環境加入一些參數,提升mysql效能

mysql官網https://www.mysql.com/

本文採用5.1版本盡心安裝說明,後面版本如5.5安裝方法會有些不一樣,在公司的一些生產環境中也有用到

5.1版本mysql。

下載mysql源碼

解壓tar zxf mysql-5.1.72.tar.gz


cd ?mysql-5.1.72


配置

./configure --prefix=/usr/local/mysql \

--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \

--localstatedir=/usr/local/mysql/data\ ? ?

--enable-assemble \

--enable-thread-safe-client \

--with-mysqld-user=mysql \

--with-big-tables \

--with-pthread \

--with-extra-charsets=complex \

--with-readline \

--with-ssl \

--with-mysqld-ldflags=-all-static \

--with-client-ldflags=-all-static

[[email protected] mysql-5.1.72]# ./configure --help ?查看具體的配置參數


make&&make install

這裡採用開發測試模板

/bin/cp support-files/my-small.cnf ? /etc/my.cnf

建立資料庫檔案

mkdir -p /usr/local/mysql/data

chown -R mysql /usr/local/mysql授權mysql使用者可以訪問mysql目錄

/usr/local/mysql/bin/mysql_install_db --user=mysql安裝mysql資料庫檔案

安裝完後會有一些相關說明,如如何啟動等等。

安裝安裝說明方法啟動mysql

/usr/local/mysql/bin/mysqld_safe/usr/local/mysql/bin/mysqld_safe & ? ?&表示後台運行

為了更方便的啟動mysql,可以將mysql加到全域變數中

將mysql加到全域變數中echo ‘export PATH=$PATH:/usr/local/mysql/bin‘>>/etc/profile

source /etc/profile

執行mysql進入資料庫

[[email protected] mysql-5.1.72]# mysql

Welcome to the MySQL monitor. ?Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.72 Source distribution


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.



配置/etc/init.d/mysqld啟動mysql

cp support-files/mysql.server ?/etc/init.d/mysqld

chmod 700 /etc/init.d/mysqld 授權,

將mysql服務加到開機啟動?

[[email protected] mysql-5.1.72]# chkconfig --add mysqld

[[email protected] mysql-5.1.72]# chkconfig mysqld ?on

mysql進入資料庫

設定密碼set password for [email protected]=PASSWORD(‘123456‘);

後續採用mysql -uroot -p形式進入mysql資料庫


Linux WEB伺服器搭建-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.