openSUSE 11.1下安裝MySQL 5.0.22

來源:互聯網
上載者:User

在openSUSE 11.1下安裝MySQL 5.0.22過程

1.開啟mysql5.0.22http://download.mysql.cn/download_file/gz/5.0/mysql-5.0.22.tar.gz

2.下載的檔案名稱為mysql-5.0.22.tar.gz。

3.將下載的mysql5.0.22.tar.gz拷貝到/usr/local目錄。

4.解壓tar包,命令為:tar zxvf mysql-5.0.22.tar.gz。

5.將mysql-5.0.22目錄改名為mysql,命令為:mv mysql-5.0.22 mysql。

6.進入/usr/local/mysql目錄。

7.依次運行如下命令:

./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extral-charsets=all --enable-thread-safe-client

make

make install

8.建立mysql 使用者,命令如下:

groupadd mysql

useradd -g mysql mysql

9. cp support-files/my-medium.cnf /etc/my.cnf

10.安裝資料庫

chown -R mysql.mysql /usr/local/mysql ;改變mysql目錄的所有者。

/usr/local/mysql/scripts/mysql_install_db --user=mysql,以mysql使用者安裝資料庫

chown -R root.root /usr/local/mysql 改變mysql目錄的所有者

chmod -R 755 /usr/local/mysql

chown -R mysql.mysql /usr/local/var 改變var目錄的所有者

11. 在後台進程中啟動mysql伺服器

方法一:/usr/local/bin/mysqld_safe --user=mysql &

方法二:進入/usr/local/mysql/support-files目錄,然後啟動資料庫伺服器,命令如下:./mysql.server start。mysql.server指令碼調用mysqld_safe來啟動伺服器。

12.查看mysql服務是否啟動,在當前終端,按“enter”鍵後,運行

netstat -ant,如果能找到3306連接埠,說明mysql已經啟動。

13.登入到mysql資料庫伺服器

進入/usr/local/bin目錄,然後運行如下命令:./mysql -u root -p

提示輸入密碼,root預設的密碼為空白,所以直接“斷行符號”,便登入到了資料庫伺服器。然後便能對資料庫進行各種操作了。

14.把mysql命令添加到環境變數中

echo "export PATH=&PATH:/usr/local/bin">>/etc/profile

source /etc/profile;使環境變數立即生效。

15.將mysql設為開機自動啟動

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

chmod 755 /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --level 345 mysqld on

檢查一下/etc/init.d/rc3.d、/etc/init.d/rc4.d、/etc/init.d/rc5.d目錄是否有軟串連檔案S01mysqld檔案,如果沒有需要建立軟串連檔案

ln -s S01mysqld /etc/init.d/mysqld.

這樣重啟機器後,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.