linux的mysql編譯安裝方法教程,mysql安裝方法

來源:互聯網
上載者:User

linux的mysql編譯安裝方法教程,mysql安裝方法

linux的mysql編譯安裝方法教程

解包。

去鏡像裡下個ncurses-devel

ncurses-devel是字元終端下螢幕控制的基本庫,包括面板和菜單功能,在TTY下登入到主機上mysql需要的。

mysql 需要用cmake編譯

yum install cmake

groupadd mysql 建立組

useradd -M -s /sbin/nologin mysql -g mysql 建立使用者並禁止登陸

編譯。

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all

make && make install 安裝

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

rm -rf /etc/my.cnf #基本操作。

[root@localhost mysql-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf #去安裝包裡把配置好的設定檔複製到etc

/usr/local/mysql/scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ #初始化資料庫

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

source /etc/profile

使/etc/profile裡的配置立即生效

添加到本地服務。

[root@localhost mysql-5.5.22]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@localhost mysql-5.5.22]# chmod +x /etc/rc.d/init.d/mysqld

[root@localhost mysql-5.5.22]# chkconfig --add mysqld

[root@localhost mysql-5.5.22]# service mysql start

訪問mysql。

mysql -u root

預設沒有密碼。

mysql> update mysql.user set password=password('12345') where user='root'; #在資料庫裡設定密碼

mysqladmin -u root -p password '12345' # 退出後這條命令可以設定密碼。

安裝完畢。

聯繫我們

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