创建数据库、业务用户
create database xxx character set utf8 collate utf8_bin;grant all privileges on xxx.* to 'xxx'@'%' identified by 'pass' with grant option;grant all privileges on xxx.* to 'xxx'@'127.0.0.1' identified by 'pass' with grant option;grant all privileges on xxx.* to 'xxx'@'localhost' identified by 'pas...
myisam表结构变更时出现Waiting for table metadata lock
alter table user_tab add name_en varchar(90) null COMMENT '英语名';但是使用show processlist看不到任何其它锁住表的语句,用innodb_trx也没用,但把所有连接杀掉是有效的,如下:use information_schema;select concat('kill ',id,';') from processlist;然后执行kill命令,将所有连接杀掉,重新执行下面语句即可...
MyISAM表锁的解决方案
Table_locks_immediate和Table_locks_waited两个状态:Table_locks_immediate表示立即释放表锁数,Table_locks_waited表示需要等待的表锁数,如果Table_locks_immediate / Table_locks_waited > 5000,说明不严重,因为InnoDB是行锁而MyISAM是表锁,对于高并发写入的应用InnoDB效果会好些。示例中的服务器Table_l...
忘记本地root的登录密码咋办?
解决过程:1、编辑/etc/my.cnf在[mysqld] 配置部分添加一行skip-grant-tables 2、保存后重启mysql[root@localhost etc]# service mysqld restartShutting down MySQL. &nbs...
理解:MySQL的null与空字符串的不同
MySQL的null与空字符串:搞过Oracle的人,常常会对MySQL的null与空字符串''搞错。在Oracle里:null 与 ''是等价的。15:02:40 sql>create table test(v varchar2(10));15:02:46 sql>insert into test values('');15:03:07 sql>insert into test values(null);15:03:12 sql>commit;15:04:05 sql>select count(...
测试下1
测试下