標籤: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