码迷,mamicode.com
首页 > 数据库 > 详细

mysql 安装

时间:2016-08-02 11:39:33      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:

编译环境
yum install gcc gcc-c++ ncurses-devel perl
依赖
yum install boost boost-devel boost-doc

安装cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make
make install

安装mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.51.tar.gz

解压后进入mysql-5.5.51
cmake -DCMAKE_INSTALL_PREFIX=/software/installed/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install

添加用户和分组
groupadd mysql
useradd -r -g mysql mysql

配置与初始化
cd /software/installed/mysql/
chown -R mysql:mysql .
chown -R mysql:mysql /usr/local/mysql/data
cp support-files/my-large.cnf /etc/my.cnf //增加配置文件
cp support-files/mysql.server /etc/init.d/mysql //加入service
scripts/mysql_install_db --datadir=/usr/local/mysql/data --user=mysql
启动mysql
service mysql start

为root设置密码

设置PATH
vi /etc/profile
在文件末尾加上
PATH=/software/installed/mysql/bin:$PATH
export PATH
source /etc/profile

mysql -uroot
mysql> SET PASSWORD = PASSWORD(‘mysqlroot123456‘);
设置远程可以访问
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.%‘ IDENTIFIED BY ‘mysql123456‘ WITH GRANT OPTION;
eixt;

配置iptables 3306端口通过
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart

mysql 安装

标签:

原文地址:http://www.cnblogs.com/xiezhengcai/p/5728367.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!