Mysql安裝--【2】

來源:互聯網
上載者:User

標籤:mysql

環境:

linux

CentOS6.8

epel

http://mirrors.aliyun.com/repo/Centos-6.repo

mysql

mysql-5.5.49.tar.gz

kernel

2.6.32-642.el6.x86_64

本機IP

10.0.0.51

1、安裝依賴包
[[email protected] tools]# yum -y install gcc cmake ncurses-devel cmakencurses-devel libxml2-devel libtool-ltdl-devel gcc-c++ autoconf automake bisonzlib-devel
2、上傳源碼包
[[email protected] ~]# mkdir -p /application/[[email protected] ~]# mkdir -p /server/tools[[email protected] ~]# cd /server/tools[[email protected] tools]# rz[ro[email protected] tools]# tar xf mysql-5.5.49.tar.gz [[email protected] tools]# cd mysql-5.5.49
3、編譯安裝
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.49 -DMYSQL_DATADIR=/application/mysql-5.5.49/data -DMYSQL_UNIX_ADDR=/application/mysql-5.5.49/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0

 

提示,編譯時間可配置的選項很多,具體可參考官方文檔:

make

#[100%] Built target my_safe_process

make install
4、軟串連
ln -s /application/mysql-5.5.49/ /application/mysql

如果上述操作未出現錯誤,則MySQL5.5.49軟體cmake方式的安裝就算成功了

檢查:

[[email protected] mysql-5.5.49]# ln -s /application/mysql-5.5.49//application/mysql[[email protected] mysql-5.5.49]# ll /application/total 4lrwxrwxrwx  1root root   26 Nov 11 18:25 mysql ->/application/mysql-5.5.49/drwxr-xr-x 13 root root 4096 Nov 11 18:25mysql-5.5.49[[email protected] mysql-5.5.49]# echo $?0
5、初始化
[[email protected] ~]# /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --user=mysqlInstalling MySQL system tables...161111 18:35:25 [Note] /application/mysql//bin/mysqld(mysqld 5.5.49) starting as process 14060 ...OKFilling help tables...161111 18:35:25 [Note]/application/mysql//bin/mysqld (mysqld 5.5.49) starting as process 14067 ...OK To start mysqld at boot time you have to copysupport-files/mysql.server to the right place foryour system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQLroot USER !To do so, start the server, then issue thefollowing commands: /application/mysql//bin/mysqladmin -u root password‘new-password‘/application/mysql//bin/mysqladmin -u root -h db01password ‘new-password‘ Alternatively you can run:/application/mysql//bin/mysql_secure_installation which will also give you the option of removing thetestdatabases and anonymous user created bydefault.  This isstrongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with:cd /application/mysql/ ;/application/mysql//bin/mysqld_safe & You can test the MySQL daemon withmysql-test-run.plcd /application/mysql//mysql-test ; perlmysql-test-run.pl Please report any problems athttp://bugs.mysql.com/
6、複製設定檔到etc目錄下
[[email protected] ~]# /bin/cp /application/mysql/support-files/my-small.cnf /etc/my.cnf
7、建立mysql使用者並設定目錄許可權
[[email protected] ~]# useradd -s /sbin/nologin mysql -M[[email protected] ~]# chown -R mysql.mysql /application/mysql/[[email protected] ~]# ls -l /application/mysql/

  8、添加/etc/init.d/mysql檔案

[[email protected] ~]# /bin/cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
9、啟動mysql
[[email protected] ~]# /etc/init.d/mysqld startStarting MySQL.. SUCCESS![[email protected] ~]# ss -lntup|grep mysqltcp   LISTEN     0      50                     *:3306                  *:*      users:(("mysqld",14328,10))
[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# chkconfig --list mysqldmysqld         0:off   1:off   2:on    3:on    4:on    5:on    6:off
10、加入環境變數和開機自啟動
[[email protected] ~]#PATH="$PATH:/application/mysql/bin"[[email protected] ~]# echo‘PATH="$PATH:/application/mysql/bin"‘ >>/etc/profile[[email protected] ~]# . /etc/profile


本文出自 “宋某人c” 部落格,請務必保留此出處http://syaving.blog.51cto.com/5614476/1878661

Mysql安裝--【2】

聯繫我們

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