MySQL 5.5.32 编译安装
短信预约 -IT技能 免费直播动态提醒
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、编译环境准备
# 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
# sed -i 's/datadir=\/var\/lib\/mysql/datadir=\/usr\/local\/mysql\/data/g' /etc/my.cnf
# sed -i 's/socket=\/var\/lib\/mysql\/mysql.sock/socket=\/usr\/local\/mysql\/tmp\/mysql.sock/g' /etc/my.cnf
# 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";
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341