首页 > 数据库技术 > 详细

mysql5.5编译安装过程(自己总结)

时间:2016-01-06 19:49:49      阅读:224      评论:0      收藏:0      [点我收藏+]
一,安装过程
//创建mysql安装目录,创建数据存放目录,创建用户和用户组与赋予数据存放目录权限
mkdir -p /usr/local/mysql/
mkdir -p /data/mysql/    
groupadd mysql
useradd -g mysql mysql
chown mysql:mysql -R /data/mysql/

//安装cmake (mysql5.5以后是通过cmake来编译的)
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
tar zxvf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure
gmake  (或make)
make install

//安装mysql
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.38.tar.gz
下载mysql-5.5.16.tar.gz(已经下载在本地 H:\linux下软件安装包\)
tar zxvf mysql-5.5.16.tar.gz
cd mysql-5.5.16
用cmake进行编译:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 
make
make install

//如果没有出现报错,安装完成


安装mysql出现如下的错误

  -- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) 
CMake Error at cmake/readline.cmake:83 (MESSAGE):
  Curses library not found.  Please install appropriate package,

      remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
  cmake/readline.cmake:118 (FIND_CURSES)
  cmake/readline.cmake:214 (MYSQL_USE_BUNDLED_READLINE)
  CMakeLists.txt:361 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!

解决办法:
rm -f CMakeCache.txt
yum -y install ncurses-deve



二、mysql安装后的设置和测试;
//复制配置文件
cp support-files/my-medium.cnf /etc/my.cnf 
//初始化数据库  (必须的,很重要)
chmod 755 scripts/mysql_install_db
scripts/mysql_install_db  --user=mysql  --basedir=/usr/local/mysql --datadir=/data/mysql/ 
//设置mysqld的开机启动
cp support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig mysql on
//配置环境 (为了方便,将mysql 的bin目录加到PATH中,在/etc/profile中加入mysql/bin,顺便增加两个别名方便操作)
export PATH=/usr/local/mysql/bin:$PATH 
//开关客户端 
alias mysql_start="mysqld_safe&"
alias mysql_stop="mysqladmin -uroot -p shutdown"
//启动mysql服务
/etc/init.d/mysql start
//查看是否启动
ps -ef |grep mysqld

设置root帐户的密码
mysqladmin -u root password yourpassword
删除本机匿名连接的空密码帐号
use mysql;
update user set password=root where user = 127.0.0.1;     //给本地账户设置一个密码
delete from user where password="";    //删除空密码
flush privileges;                      //使设置生效


三、实现MySQL远程连接的实际操作流程
mysql –u root –p
use mysql;
select user,password,host from user; 
update user set host = 192.168.% where user = 127.0.0.1;   //设置本地用户可以在任何终端登录
GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY root密码 WITH GRANT OPTION;  //给root远程登录的权限
FLUSH PRIVILEGES;                                              //使设置生效

 

mysql5.5编译安装过程(自己总结)

原文:http://www.cnblogs.com/mingaixin/p/5106512.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!