设为首页 加入收藏

TOP

CentOS 6.6二进制包安装MySQL5.5
2017-04-24 10:23:20 】 浏览:7575
Tags:CentOS 6.6 二进制 安装 MySQL5.5

2. 选择的理由
  * 支持多种平台[AIX、FreeBSD、HP-UX、Linux、Mac OS、OpenBSD、Solaris、Windows......]
  * 支持并提供多语言API
  * 开源,采用了 GPL协议,可以修改源码来开发自己的 MySQL 系统
  * 支持标准SQL语句
  * 支持多种存储引擎


4. 安装
 * 进入包下载目录
[root@mysql ~]# cd /usr/local/src/


 * 下载MySQL二进制包[mysql-5.5.53-linux2.6-x86_64.tar.gz]
[root@mysql src]# wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.53-linux2.6-x86_64.tar.gz


 * 解包
[root@mysql src]# tar zxf mysql-5.5.53-linux2.6-x86_64.tar.gz


 * 移动到mysql安装目录
[root@mysql src]# mv mysql-5.5.53-linux2.6-x86_64 /usr/local/mysql-5.5.53


 * 创建mysql软链接


[root@mysql src]# ln -s /usr/local/mysql-5.5.53 /usr/local/mysql


 * 进入mysql目录
[root@mysql src]# cd /usr/local/mysql


 * 复制mysql配置文件到指定位置
[root@mysql mysql]#  \cp support-files/my-medium.cnf /etc/my.cnf


 * 创建mysql服务用户
[root@mysql mysql]# useradd -r -s /sbin/nologin -M mysql


 * 创建mysql数据目录
[root@mysql mysql]# mkdir /data/mysql -p


 * 更改数据目录所属用户与组
[root@mysql mysql]# chown mysql.mysql /data/mysql


 * mysql初始化
[root@mysql mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql


Installing MySQL system tables...
170325  3:12:16 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
170325  3:12:16 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.53-log) starting as process 8023 ...
OK
Filling help tables...
170325  3:12:16 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
170325  3:12:16 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.53-log) starting as process 8031 ...
OK
 
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
 
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h mysql password 'new-password'
 
Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation
 
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
 
See the manual for more instructions.
 
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
 
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
 
Please report any problems at http://bugs.mysql.com/


看到如上两个OK就证明初始化成功


5. 创建启动脚本
 * 复制启动脚本到service 服务管理目录下[ /etc/init.d ]
[root@mysql mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld


 * 修改mysql启动脚本 [ /et/init.d/mysqld ]
basedir=/usr/local/mysql
datadir=/data/mysql


 * 添加进service服务管理
[root@mysql mysql]# chkconfig --add mysqld


6. 服务启动测试


CentOS 6.6二进制包安装MySQL5.5


mysql启动成功


7. 服务连接测试
[root@mysql mysql]# /usr/local/mysql/bin/mysql


CentOS 6.6二进制包安装MySQL5.5


通过mysql客户端连接成功


8. 设置root密码
[root@mysql mysql]# /usr/local/mysql/bin/mysqladmin -u root password '123456'


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇MySQL分库分表备份脚本 下一篇MariaDB 10.1.22编译安装

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目