Initial commit

This commit is contained in:
谢洪龙
2017-08-23 14:09:21 +08:00
commit 2627e2f5c4
231 changed files with 16861 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
#中文乱码
修改 /etc/mysql/my.cnf (默认的安装路径)
vim /etc/mysql/my.cnf
打开my.cnf后,在文件内的[mysqld]下增加如下两行设置:
character_set_server=utf8
init_connect='SET NAMES utf8'
#升级,在linux上先查看系统的版本号,根据版本号对应下载
more /etc/redhat-release
rpm -i http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
yum list mysql*
yum install mysql-community-server
1、安装
查看有没有安装过:
yum list installed mysql*
rpm -qa | grep mysql*
查看有没有安装包:
yum list mysql*
安装mysql客户端:
yum install mysql
安装mysql 服务器端:
yum install mysql-server
yum install mysql-devel
删除
yum -y remove mysql*
2、启动&&停止
数据库字符集设置
mysql配置文件/etc/my.cnf中加入default-character-set=utf8
启动mysql服务:
service mysqld start或者/etc/init.d/mysqld start
开机启动:
chkconfig -add mysqld,查看开机启动设置是否成功chkconfig --list | grep mysql*
mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
停止:
service mysqld stop
2、登录
创建root管理员:
mysqladmin -u root password 123456
www.2cto.com
登录:
mysql -u root -p输入密码即可。
忘记密码:
service mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root
use mysql
update user set password=password("new_pass") where user="root";
flush privileges;
3、远程访问
开放防火墙的端口号
mysql增加权限:mysql库中的user表新增一条记录host为“%”,user为“root”。
4、Linux MySQL的几个重要目录
www.2cto.com
数据库目录
/var/lib/mysql/
配置文件
/usr/share /mysqlmysql.server命令及配置文件)
相关命令
/usr/binmysqladmin mysqldump等命令)
启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)
创建用户:
create user 'ifish'@'localhost' identified by 'ifish7pwd';
赋权限
grant all on myfishdb.* to 'ifish'@'localhost';
删除用户
drop user 'ifish'@'localhost';
创建数据库
DROP DATABASE IF EXISTS `myfishdb`;
CREATE DATABASE `myfishdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;