mysql 管理

linux

安装

yum install mysql mysql-server mysql-devel mysql-libs

配置文件

/etc/my.ini

启动

service mysqld start|stop|restart

自动启动

chkconfig mysqld on

管理

mysql

设置数据库引擎

[引擎差异](http://www.cnblogs.com/0201zcr/p/5296843.html 引擎差异)
默认为MYISAM, 某些情况下需要修改为InnoDB
mysql> SET storage_engine=InnoDB;

创建用户和授权

用户名: weibo
数据库: weibo
密码: 3c38f920d8bf11c96c09023fe49c8917

1
2
3
4
5
6
7
create database if not exists weibo default character set utf8;
GRANT ALL PRIVILEGES ON `weibo`.* TO 'weibo'@'%' IDENTIFIED BY '3c38f920d8bf11c96c09023fe49c8917';
GRANT ALL PRIVILEGES ON `weibo`.* TO 'weibo'@'localhost' IDENTIFIED BY '3c38f920d8bf11c96c09023fe49c8917';
SET old_passwords = 0;
UPDATE mysql.user SET Password = PASSWORD('3c38f920d8bf11c96c09023fe49c8917') WHERE User = 'weibo' limit 1;
SELECT LENGTH(Password) FROM mysql.user WHERE User = 'weibo';
FLUSH PRIVILEGES;

测试

mysql -uweibo -p3c38f920d8bf11c96c09023fe49c8917

windows

1
2
3
4
mysqld --romve 删除mysql服务
mysqld --install 安装mysql服务
mysqld --initialize 一定要初始化
net start mysql 启动服务

my.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[mysql]
; 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
;设置3306端口
port = 3306
; 设置mysql的安装目录

basedir=F:\mysql-5.7.18-winx64

; 设置mysql数据库的数据的存放目录

datadir=F:\mysql-5.7.18-winx64\data

; 允许最大连接数

max_connections=200

; 服务端使用的字符集默认为8比特编码的latin1字符集

character-set-server=utf8

; 创建新表时将使用的默认存储引擎

default-storage-engine=INNODB
Related post
Comment
Share
  • Hello World

    Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using ...

    Hello World
  • install elasticsearch on linux

    Linux安装elasticsearch配置参考下载http://172.16.60.100/tools/elasticsearch/ 配置好JAVA_HOME需要jkd1.7以上版本, 配置好JAVA_HOME ES 5.3yum安...

    install elasticsearch on linux
  • flowchat

    $$E=mc^2$$ $$\sum_{i=1}^n a_i=0$$$$\sum ^ {j-1}{k=0}{\widehat{\gamma} {kj} z k } $$ $$\Gamma(z) = \int_0^\infty t^...

    flowchat
  • linux-common-comand

    linux 一些命令工具nginx basic 认证文件生成12yum install httpd-toolshtpasswd -c 生成的认证文件名 用户名 字符串搜索12grep -Ril '搜索内容' ./...

    linux-common-comand
  • cabot install

    cabot 安装环境 centos6.5 64 python: 2.7 python2.7 安装参考graphite-install-on-centos cabot安装参考https://gist.github.com/Gromph...

    cabot install
  • luigi install

    luigi 安装官方文档: http://luigi.readthedocs.io/en/latest/中文: https://github.com/17zuoye/luiti/blob/master/README.zh_CN.mar...

    luigi install
  • centos repo

    公司centos源centos源列表(翻墙): https://www.centos.org/download/mirrors/epel源列表(翻墙): https://fedoraproject.org/wiki/EPEL163源:...

    centos repo
  • graphite install on centos

    graphite 安装环境 centos6.5 64 python: 2.7公司机器: 172.16.60.139 参考客户端: graphitesend 中文文档:https://segmentfault.com/search?q...

    graphite install on centos
  • linux install nginx

    linux 安装nginx一键安装123456789101112wget http://ip/tools/nginx/nginx-1.10.2.tar.gztar -vxf nginx-1.10.2.tar.gz cd nginx-1...

    linux install nginx
  • private docker server

    搭建docker私有服务器公司: 172.16.60.204系统: centos 7 1611版本python: 系统自带2.7.5docker-registry功能增强: Harbor 国内镜像使用http://www.cnblog...

    private docker server
Please check the comment setting in config.yml of hexo-theme-Annie!