使用標準源分發安裝MySQL

來源:互聯網
上載者:User

標籤:mysql install

編譯前安裝準備

OS:CentOS 6.9

Mysql:5.7.18


下載Mysql源

官網源:mysql-boost mysql

搜狐源:mysql-boost mysql

安裝Mysql之前卸載原有的版本

查詢Mysql目錄檔案 卸載原有MySQL

# rpm -qa | grep mysql

# find / -name mysql

# yum remove -y mysql-libs-5.1.73-3.el6_5.x86_64

安裝編譯環境

# yum -y install make wget gcc-c++ cmake bison-devel ncurses-devel

 Preconfiguration setup

# groupadd mysql

# useradd -r -g mysql -s /bin/false mysql

Beginning of source-build specific instructions

# mkdir ~/mysql && cd ~/mysql

# mkdir -p /data/mysql_data

# wget -c https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz

# tar -zxvf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18/

# cmake . \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/mysql_data \

-DSYSCONFDIR=/etc \

-DDOWNLOAD_BOOST=1 \

-DWITH_BOOST=/usr/local/boost \

-DWITH_ARCHIVE_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

# make

# make install

 End of source-build specific instructions

 Postinstallation setup

# cd /usr/local/mysql

# chown -R mysql .

# chgrp -R mysql .

 Before MySQL 5.7.6

# bin/mysql_install_db --user=mysql

 MySQL 5.7.6 and up

# bin/mysqld --initialize --user=mysql

# bin/mysql_ssl_rsa_setup

# chown -R root .

# chown -R mysql /data

# bin/mysqld_safe --user=mysql &

 配置開機啟動項

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

# chmod +x /etc/init.d/mysql.server

# chkconfig --add mysql.server

# chkconfig mysql.server on

 配置/etc/my.cnf 僅供參考,可以不配用預設的。

啟動mysql

# service mysql.server start

加入開機啟動項

# chkconfig --live 35 mysql.server on

查看連接埠是否被佔用

# netstat -tulnp | grep 3306

查看資料庫版本

# ln -s /usr/local/mysql/bin/mysql /usr/bin/

# mysql --version

登入資料庫

# mysql -u root -p

查看資料庫

>show databases;

重設密碼,這裡密碼設定為?root?

>set password = password(‘?root?‘);

退出資料庫

>exit;


本文出自 “耐心是美德” 部落格,請務必保留此出處http://1550349.blog.51cto.com/1540349/1932470

使用標準源分發安裝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.