linux下的mysql

來源:互聯網
上載者:User

標籤:ror   creat   use   pat   .so   linu   連結   code   mirror   

1、到下面地址下載通用二進位包

wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.53-linux2.6-x86_64.tar.gz

2、具體的安裝文檔

http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

3、安裝解釋

建立mysql使用者和組,為系統使用者和系統組

groupadd -r -g 306 mysql

useradd -r -g 306 -u 306 mysql

解壓下載的tar包到指定目錄下,一般為/usr/local/mysql

tar -xf mysql-5.5.53-linux2.6-x86_64.tar.gz -C /usr/local

在/usr/local下建立軟串連,連結至mysql-5.5.53-linux2.6-x86_64.tar.gz

ln -sv mysql-5.5.53-linux2.6-x86_64.tar.gz mysql

將mysql目錄下的檔案屬主屬組改為mysql

chown -R mysql:mysql /usr/local/mysql/*

為了存放資料建立新的邏輯卷

建立新分區fdisk /dev/sda 分區類型改為linux lvm

建立物理卷 pvcreate /dev/sda5

建立卷組  vgcreate myvg /dev/sda5

建立邏輯卷 lvcreate -n mydata -L 5G myvg

格式化  mke2fs -j /dev/myvg/mydata

執行初始化指令碼

/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/mydata/data

將mysql目錄屬主改為root

chown -R root /usr/local/mysql/*

將support-files目錄下的設定檔複製到/etc/my.cnf,修改設定檔,添加datadir=/mydata/data

cp /usr/local/mysql/support-files/my-large.cnf  /etc/my.cnf

將support-files目錄下的mysql.server複製到/etc/init.d目錄下,設定服務自啟動

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

systemctl enable mysqld

輸出man文檔,庫檔案,標頭檔

vim /etc/man_db.conf 添加man文檔目錄

vim /etc/ld.so.conf.d/mysql.conf 添加lib目錄

ln -sv /usr/local/mysql/include /usr/include

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.