Linux下配置使用免安装版MySQL

安装环境:
操作系统MySQL版本
CentOS release 6.7 (Final)MySQL-5.6.32
安装步骤:

1、MySQL官网下载mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz。
2、解压mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz。

[lucy@min software]$ tar xf mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz
[lucy@min software]$ mv mysql-5.6.32-linux-glibc2.5-x86_64 ../mysql5632
[lucy@min mysql5632]$ pwd
/home/lucy/mysql5632

3、配置my.cnf。

[lucy@min mysql5632]$ cp support-files/my-default.cnf my.cnf
[lucy@min mysql5632]$ egrep -v "^#|^$" my.cnf 
[mysqld]
basedir = /home/lucy/mysql5632
datadir = /home/lucy/mysql5632/data
port = 9106
socket = /home/lucy/mysql5632/socket/mysql.sock
pid-file = /home/lucy/mysql5632/pid/mysql.pid
log-error = /home/lucy/mysql5632/logs/mysql.log
user = lucy
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[lucy@min mysql5632]$ mkdir socket pid logs
[lucy@min mysql5632]$ ls -ld socket/ pid/ logs/
drwxrwxr-x 2 lucy lucy 6 Aug 20 21:36 logs/
drwxrwxr-x 2 lucy lucy 6 Aug 20 21:36 pid/
drwxrwxr-x 2 lucy lucy 6 Aug 20 21:36 socket/

4、初始化MySQL。

[lucy@min mysql5632]$ scripts/mysql_install_db --defaults-file=my.cnf
Installing MySQL system tables...2016-08-20 21:39:31 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-20 21:39:31 0 [Note] ./bin/mysqld (mysqld 5.6.32) starting as process 15831 ...
OK

Filling help tables...2016-08-20 21:39:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-08-20 21:39:41 0 [Note] ./bin/mysqld (mysqld 5.6.32) starting as process 15880 ...
OK
......

初始化过程中出现两个“OK”则表示初始化成功。
5、启动MySQL。

[lucy@min mysql5632]$ bin/mysqld_safe --defaults-file=my.cnf &
[lucy@min mysql5632]$ ps aux | grep mysql
lucy     16368  0.0  0.3 113252  1588 pts/1    S    21:43   0:00 /bin/sh bin/mysqld_safe --defaults-file=my.cnf
lucy     16533  0.9 22.1 633108 109568 pts/1   Sl   21:43   0:00 /home/lucy/mysql5632/bin/mysqld --defaults-file=my.cnf --basedir=/home/lucy/mysql5632 --datadir=/home/lucy/mysql5632/data --plugin-dir=/home/lucy/mysql5632/lib/plugin --log-error=/home/lucy/mysql5632/logs/mysql.log --pid-file=/home/lucy/mysql5632/pid/mysql.pid --socket=/home/lucy/mysql5632/socket/mysql.sock --port=9106
lucy     16680  0.0  0.1 112644   976 pts/1    R+   21:43   0:00 grep --color=auto mysql

6、连接MySQL。

[lucy@min mysql5632]$ bin/mysql -h127.0.0.1 -uroot -P9106
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

首次安装好MySQL,使用root用户连接MySQL时默认密码为空,连接上去后可自行修改密码。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值