MySQL ----随笔

MySQL ----随笔

新建一个表单:create table test_ggh(ID int,name varchar(20),tele int);
删除一个表单:drop table test_ggh;

插入一列:alter table test_ggh drop column tele int not null;
添加在指定的一列:alter table 表名 add column 列名 varchar(20) not null after user1;

添加到第一列:alter table 表名 add column 列名 varchar(20) not null first;

删除一列:alter table test_ggh drop column tele;
插入一行:insert into test_ggh(ID,name,tele) values(001,'zhangsan',123);

删除 :delete from test_ggh where ID='002';

更新数据: update test_ggh set ID='002' where NAME='zhangsan';

替换部分字符串:update test_ggh set NAME=REPLACE(NAME,'综合财务科','综合管理科');

Mysql配置-允许别人链接我的Mysql

select * FROM mysql.user where user = 'root';
update mysql.user set host = '%' where user = 'root' and host = 'localhost';

mysql
mysql函数循环生成值:

CREATE DEFINER = CURRENT_USER PROCEDURE `point`()
BEGIN
 DECLARE nums INT DEFAULT 1;
 WHILE nums <=818 DO
	INSERT INTO point (id,point_id,create_time,update_time)
	VALUES (nums,nums,NOW(),NOW());
 SET nums=nums+1;
 END WHILE;
END

合并两列为一列

SELECT CONCAT(parent_machine,"_",point_id) AS new_name FROM point;
UPDATE `point` SET node_id =CONCAT(parent_machine,"_",point_id)

navicate MySQL server has gone away

show VARIABLES like '%max_allowed_packet%';
set global max_allowed_packet = 1024*1024*64;

my.ini文件中修改
#The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
#mysql_stmt_send_long_data() C API function.
max_allowed_packet=128M

最大连接数:
#The maximum amount of concurrent sessions the MySQL server will allow. One of these connections will be reserved for a user with SUPER privileges to allow the administrator to login even if the connection limit has been reached.
max_connections=151

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值