下载
windows安装包下载





linux安装包下载


windows下安装mysql(含客户端工具Navicat安装及配置)
linux下安装mysql
编译安装,自由linux
yum安装,简单sql
编译安装
参考:http://www.runoob.com/linux/mysql-install-setup.html数据库
这里介绍yum安装,centos6和centos7略有不一样vim
centos6下yum安装mysql

检查操做系统上是否已经安装了mysql数据库windows

若是安装了,就卸载centos
rpm -e或者rpm -e--nodeps工具
查看yum上提供的mysql数据库可下载的版本

安装

查看刚安装好的mysql-server

启动服务



查看是否开机自启动

设置开机自启动

修改密码,给mysql的root账号设置密码123456

登陆

字符集

退出

更改字符串


重启服务


建立新用户:CREATE USER 'test'@'localhost' IDENTIFIED BY '123456';
新用户受权:GRANT ALL PRIVILEGES ON *.* TO 'test'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
刷新受权:flush privileges;
客户端链接


解决后:

centos7下yum安装mysql

yum安装
yum -y install mariadb-server
启动服务
systemctl start mariadb.service
开机自动启动
systemctl enable mariadb.service
修改密码
/usr/bin/mysqladmin -u root password '123456'
或者:mysqladmin -u root password '123456'
登录
mysql -uroot -p123456
查看并修改字符集同centos6。(重启服务是:systemctl restart mariadb,或者systemctl restart mariadb.service)
centos7下修改mysql(yum安装)字符集及端口号
字符集

更改字符集及端口
vim /etc/my.cnf
在Linux下vim编辑过程当中,因为某种缘由异常退出正在编辑的文件,再次编辑该文件时,会出现以下提示:

使用vim编辑文件实际是先copy一份临时文件并映射到内存给你编辑,编辑的是临时文件,当执行:w后才保存临时文件到原文件,执行:q后才删除临时文件。
每次启动检索是否有临时文件,有则询问如何处理,就会出现如上情景。
解决办法:
将隐藏的*.swp文件删除便可(隐藏文件都是以.开头的,能够ll -a显示隐藏文件),原先的文件即可再次编辑。
rm -f .*.swp // 删除隐藏文件


更改字符集,添加port=3806

重启
systemctl restart mariadb
或者
systemctl restart mariadb.service
若是没法重启,能够先kill,再启动:systemctl start mariadb

若是在修改字符集前,已经建立了数据库,且在表中添加了数据,而表中字段也是有字符集的(继承数据库的字符集)
若是表中数据有中文,会没法显示
修改数据库的字符集后(修改my.cnf文件),还须要修改表的字段的字符集,

重启数据库服务(没法重启,先kill)
而后从新navicat链接,修改数据为中文,此时能够保存且查询时正常显示。