Linux下安裝mysql

來源:互聯網
上載者:User

標籤:mysql   mysql安裝   

 

安裝系統所需要的依賴包

[[email protected] ~]# yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*  cmake  bison

 

建立mysql使用者與使用者組

[[email protected] ~]# groupadd mysql

[[email protected] ~]# useradd -r -g mysql mysql

 

安裝mysql

[[email protected] ~]# tar zxvf mysql-5.5.25.tar.gz

[[email protected] ~]# cd mysql-5.5.25

[[email protected] mysql-5.5.25]# cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql/ -DMYSQL_DATADIR=/opt/mysql/data -DMYSQL_UNIX_ADDR=/opt/mysql/data/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1  -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/opt/mysql/data/mysql.sock -DMYSQL_USER=mysql  -DWITH_DEBUG=0

 

[[email protected] mysql-5.5.25]# make && make install

 

賦予相關許可權

[[email protected] mysql-5.5.25]# chown -R mysql:mysql /opt/mysql

 

 

[[email protected] mysql-5.5.25]#  /opt/mysql/scripts/mysql_install_db --user=mysql --basedir=/opt/mysql   --datadir=/opt/mysql/data

 

mysql設定檔

[[email protected] mysql-5.5.25]# cp /opt/mysql/support-files/my-large.cnf /etc/my.cnf

[[email protected] mysql-5.5.25]# cp /opt/mysql/support-files/mysql.server /etc/init.d/mysql

[[email protected] mysql-5.5.25]# chmod +x /etc/init.d/mysql

 

增加自動啟動

[[email protected] mysql-5.5.25]# chkconfig mysql on

 

啟動mysql

[[email protected] mysql-5.5.25]# /etc/init.d/mysql start

Starting MySQL......                                       [  OK  ]

 

查看mysql 的3306連接埠,看到下面說明啟動成功

[[email protected] mysql-5.5.25]#ps aux | grep 3306

mysql    17237  3.6  8.4 615660 86264 pts/2    Sl   22:10   0:01 /opt/mysql/bin/mysqld --basedir=/opt/mysql --datadir=/opt/mysql/data --plugin-dir=/opt/mysql/lib/plugin --user=mysql --log-error=/opt/mysql/data/namenode.err --pid-file=/opt/mysql/data/namenode.pid --socket=/opt/mysql/data/mysql.sock --port=3306

root     17798  0.0  0.0  61228   784 pts/2    S+   22:10   0:00 grep 3306

 

 

設定mysql初始密碼,123456是密碼,你可以設定自己需要的密碼

[[email protected] mysql-5.5.25]# /opt/mysql/bin/mysqladmin -u root password ‘123456‘

 

[[email protected] mysql-5.5.25]# /opt/mysql/bin/mysql -uroot -p123456

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.25-log Source distribution

 

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

 

mysql>

 

 

以上說明成功了

本文出自 “飛鴻遝膤” 部落格,請務必保留此出處http://jxzhfei.blog.51cto.com/1382161/1441329

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.