linux下mysql安装和调优
1.yum
yum -y install mysql-server mysql
2.RPM安装
http://dev.mysql.com/downloads/ 下载RPM包,请确认服务器版本,我的是红帽5.9,下载的是下面的版本,bundle是集合包
MySQL-5.6.21-1.rhel5.x86_64.rpm-bundle.tar
[root@localhost ~]# cd /soft/
[root@localhost soft]# ll
总计
-rwxr--r-- root root - : MySQL-5.6.-.rhel5.x86_64.rpm-bundle.tar
-rw-r--r-- wheel - : MySQL-client-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-devel-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-embedded-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-server-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-shared-5.6.-.rhel5.x86_64.rpm
-rw-r--r-- wheel - : MySQL-test-5.6.-.rhel5.x86_64.rpm
rpm -Uvh MySQL-*.rpm
mysql> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('root');
Query OK, rows affected (0.07 sec)
3.mysql的基本命令和字段类型信息
show databses;
use mysql;
show tables;
describe user;
create database cms;
select database();

DATETIME(占8字节)
TIMESTAMP(占4字节)
DATE(占4字节)
YEAR(占1字节)
TIME(占3字节)
mysql> create table user1 select * from te where username='xx';
mysql> create table user2 select * from te where false
mysql> alter table te rename to user;
mysql> alter table file change guid gid int(10) not null;
mysql> load data infile '/etc/passwd' into table file fields terminated by ":" lines terminated by "\n";
mysql> alter table file drop column id;
mysql> alter table file add id int(10) unsigned not null auto_increment primary key(id) first;
mysql> select * from file into outfile "/soft/user.txt" fields terminated by "\t" lines terminated by "\n";
service mysql start --skip-grant-table&update mysql.user set password=password("123") where user='root'
mysqladmin -uroot -p password "1234"
GRANT all ON db.* TO dbuser@'%' IDENTIFIED BY 'password'
REVOKE all ON db.* FROM dbuser@'%'
flush privileges;
MySQL日志类型
1.错误日志:记录数据库服务启动,运行过程中产生的错误信息 默认开启
2.查询日志:记录登录用户执行的sql语句 默认不开启 /etc/my.cnf
general-log
3.慢查询日志:超时查询sql 默认不开启,默认超时10s
slow-query-log
slow-query-log-file=iflytek-slow-query.log
long-query-time=5
4.binlog日志:使数据发生改变的sql语句 默认不开启
打开/etc/my.cnf
log-bin=mysql-bin【默认名称可以不写】
mysqlbinlog -start-position=4 -stop-position=200 bin-log.000001 | mysql -uroot -proot
show binlog events
flush logs;
purge master logs to "iflytek-bin.000002" 删除002之前的binlog
reset master 重新设置binlog日志
【etc/my.cnf】
log-bin=/mysqldata/iflytek-bin
chown mysql /mysqldata/
linux下mysql安装和调优的更多相关文章
- linux下MySQL安装登录及操作
linux下MySQL安装登录及操作 二.安装Mysql 1.下载MySQL的安装文件 安装MySQL需要下面两个文件: MySQL-server-4.0.16-0.i386.rpm MySQL-cl ...
- Linux下MySQL安装和配置
--Linux下MySQL安装和配置 ---------------------------2014/05/18 Linux下MySQL的配置和安装 本文的安装采用 rpm 包安装 1.首先在官网下载 ...
- Linux下Mysql安装(RPM安装)
1. 首先检查机器里是否已经存在MySQL $ rpm -qa | grep mysql 2. 去官网下载相应的rpm包:https://dev.mysql.com/downloads/mysql/ ...
- Linux下MySQL安装及配置
Linux下MySQL安装及配置 安装MySQL Ubuntu系统中,直接使用apt install的方式去安装MySQL的服务端和客户端,MySQL的客户端必须安装,否则无法通过命令连接并操作MyS ...
- linux 下 mysql安装和配置
最近在学习R语言,看到R与数据库交互这一部分,就自己动手实践了一下,数据库选择的是mysql,主要记录下linux下怎么安装mysql. 网上的很多资料都有相关的文章,这里只是记录下自己安装过程中遇到 ...
- Linux下mysql安装过程
到mysql官网下载mysql编译好的二进制安装包,在下载页面Select Platform:选项选择linux-generic,然后把页面拉到底部,64位系统下载Linux - Generic (g ...
- Linux下Mysql安装教程详解
Linux下软件安装一般有三种方式:RPM包方式(通过Redhat 第三方包管理系统).二进制包和源码包.本篇主要介绍二进制包安装mysql数据库的方式. 如何获取二进制源码包 当然是到mysql官网 ...
- Linux下mysql安装记录
1.MySQL下载路径:https://dev.mysql.com/downloads/ Linux下的安装步骤:http://www.runoob.com/linux/mysql-install-s ...
- linux下MySQL安装及设置
转自:http://www.entage.net/1/viewspace-25420 1. 关于本文 本文将以MySQL 5.0.51为例,以CentOS 5为平台,讲述MySQL数据库的安装和 ...
随机推荐
- List用法与介绍
泛型的好处:它为使用c#语言编写面向对象程序增加了极大的效力和灵活性.不会强行对值类型进行装箱和拆箱,或对引用类型进行向下强制类型转换,所以性能得到提高. 性能注意事项:在决定使用ILis ...
- pthread信号
信号是典型的异步事件.内核在某个信号出现时有三种处理方式: 忽略信号,除了SIGKILL和SIGSTOP信号不能忽略外,其他大部分信号都可以被忽略: 捕捉信号,也就是在信号发生时调用一个用户函数,注意 ...
- windows7安装django并创建第一个应用
1.安装django 1.1.下载Django包 https://www.djangoproject.com/download/https://www.djangoproject.com/m/rele ...
- Kotlin Android学习入门
1.基本语法 https://github.com/mcxiaoke/kotlin-notes/blob/master/kotlin-tutorial-basic.md 2.推荐两篇Kotlin An ...
- 找到一篇关于2.4/5G信道的新介绍
关于部分手机无法搜索到5G wifi信号的解决方法第一次在论坛发基础理论贴,希望能普及关于5G wifi的基础知识. 发此贴的原因是基于本人突然发现:MX3刷了3.4.1系统后,搜索不 ...
- CentOS iptables防火墙的基本应用讲解
iptables是Linux下不错的防火墙软件,本文主要给大家介绍下iptables的安装.规则增加和清除.开放指定端口.屏蔽指定ip和ip段等CentOS下iptables的基本应用. 一.ipta ...
- python渗透测试工具包
网络 Scapy, Scapy3k: 发送,嗅探,分析和伪造网络数据包.可用作交互式包处理程序或单独作为一个库.pypcap, Pcapy, pylibpcap: 几个不同 libpcap 捆绑的py ...
- -bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory python多版本造成额问题 找不到p ...
- call apply 使用
1.call 跟 apply的主要区别: call传入参数是一个一个传入,而 apply 使用的是数组传入 call(obj,arg1,arg2,arg3,arg4) apply(obj,[arg1, ...
- 自动把\r\n 替换成<p></p>
function nl2p($string, $line_breaks = true, $xml = true) { // Remove existing HTML formatting to avo ...