MySQL 5.5.32 编译安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 5.5.32 编译安装相关的知识,希望对你有一定的参考价值。
最近在听老男孩老师视频上课,把操作过程做了笔记,方便以后使用。
1、安装环境准备
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo # yum install cmake -y # yum install ncurses-devel -y # useradd -s /sbin/nologin -M mysql
2、编译安装MySQL 5.5.32
# mkdir /usr/local/mysql # mkdir /software # cd /software/ # tar -zxvf mysql-5.5.32.tar.gz #上传文件:mysql-5.5.32.tar.gz 到: /software 目录 # cd mysql-5.5.32 # cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/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 && make install
3、初始化MySQL数据库
# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --user=mysql #初始化数据库 # cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld #====================*****==========================#修改文件:/etc/my.cnf ,因为我的MySQL安装在/usr/local/mysql目录下面 #[mysqld] # datadir = /usr/local/mysql/data # socket=/usr/local/mysql/tmp/mysql.sock #=================================================== # chown -R mysql.mysql /usr/local/mysql # /etc/init.d/mysqld start #启动数据库服务 # /usr/local/mysql/bin/mysql # cp /usr/local/mysql/bin/mysql /usr/local/sbin/ #把mysql客户端程序复制到/usr/local/sbin/目录下面 # /usr/local/mysql/bin/mysqladmin -u root password ‘123456‘ #更改root用户密码 # mysql -uroot -p123456 >drop user ""@Lab-Srv-02; >drop user "root"@"::1"; >drop user ""@"localhost";
以上是关于MySQL 5.5.32 编译安装的主要内容,如果未能解决你的问题,请参考以下文章
cmake源码编译安装mysql-5.5.32:多实例遇到的坑
cmake源码编译安装mysql-5.5.32:多实例遇到的坑