mysql5.6 安装配置

1 首先下载yum 库。本次基于centos6.10 对应下载地址https://dev.mysql.com/get/mysql80-community-release-el6-2.noarch.rpm

2 默认是8.0版本,更改版本,yum-config-manager --disable mysql80-community

  yum-config-manager --enable mysql56-community

3 核对可以版本 yum repolist enabled | grep mysql

4 sudo yum install mysql-community-server

自动安装完毕,启动。service msyqld start  根据提示设置密码,清除测试账户及数据库。

5 变更数据库存储目录

  A: service mysqld stop ,停止数据库服务。vim /etc/my.cnf 更改配置文件 

#datadir=/var/lib/mysql
datadir=/mnt/sdc/mysql
#socket=/var/lib/mysql/mysql.sock
socket=/mnt/sdc/mysql/mysql.sock

skip-name-resolve

[client]
port = 3306
socket = /mnt/sdc/mysql/mysql.sock

B: cp -a  /var/lib/mysql /mnt/sdc/ 拷贝数据库文件 至新的目录。做软连接 ln -s  /mnt/sdc/mysql/mysql.sock /var/lib/mysql/mysql.sock 不然程序连接不上去。

C: 如果用程序连接。要建立'root'@'::1'用户。

6 创建用户授权  CREATE USER user01@'localhost' IDENTIFIED BY 'password1'; 

   grant GRANT ALL PRIVILEGES ON *.* TO user01 identified by 'paasword1';

注意每个用户和@后面的地址关联,局域网访问用user@'192.168.0.%' 表示;

7 建库 建表 create database tickdata; CREATE TABLE `reftable` (
  `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` date DEFAULT NULL,
  `time` time DEFAULT NULL,
  `insid` char(31) DEFAULT NULL,
  `price` float DEFAULT NULL,
  `vol` int(11) DEFAULT NULL,
  `bidprice` float DEFAULT NULL,
  `bidvol` int(11) DEFAULT NULL,
  `askprice` float DEFAULT NULL,
  `askvol` int(11) DEFAULT NULL,
  `avprice` float DEFAULT NULL,
  `openinst` int(11) DEFAULT NULL,
  PRIMARY KEY (`row_id`)
) ;

create database KbarMin1;create database Kbar_day;

CREATE TABLE `reftable` (
  `row_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `date` date DEFAULT NULL,
  `time` time DEFAULT NULL,
  `insid` char(31) DEFAULT NULL,
  `oprice` float DEFAULT NULL,
  `hprice` float DEFAULT NULL,
  `lprice` float DEFAULT NULL,
  `cprice` float DEFAULT NULL,
  `opinst` int(11) DEFAULT NULL,
  `vol` int(11) DEFAULT NULL,
  `num` smallint(6) DEFAULT NULL,
  PRIMARY KEY (`row_id`)
);
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值