sql学习

mac2022-06-30  22

1.把表批量导入导其他数据库的某表

insert into dsyh_system.api_user_address select id id,user_id user_id,`name` `name`,phone phone,province,city,county,info, case is_default when 1 then 1 when 99 then 0 END as is_default,insert_time as create_time ,update_time, case is_delete when 1 then 1 when -1 then 0 end DELETE_flag from dsyh_eshop.cm_user_address_tbl

2.mysql配置主从复制遇到的问题

change master to master_host='172.24.254.105',master_port=31857, master_user='dshb', master_password='20190923',master_log_file='binlog.000003', master_log_pos=154; grant replication slave on *.* to 'dshb'@'localhost' identified by '20190923';

创建数据库:

CREATE DATABASE IF NOT EXISTS testDB default charset utf8 COLLATE utf8_general_ci; 创建数据库用户: create user 'csadmin'@'%' identified by '123456'; 修改用户密码:update user set password=password(‘123456‘) where user=‘root‘; 创建数据库用户并允许远程登陆:grant all on *.* to admin@'%' identified by '123456' with grant option; 给与所有权限:grant all privileges on tests.* to csadmin@'%' identified by '123456'; 给与某个用户某个数据的全部权限:grant all privileges on test.* to csadmin@'%' identified by '123456';

3.网络常用

查看mac地址:arp -a 查看IP:ipconfig/all

 4.模糊查询

UPDATE dsyh_goods.bus_goods SET logo_img=REPLACE(logo_img,'/client/www.dongshanhaibao.com/','/');

 

转载于:https://www.cnblogs.com/aqicheng/p/11603071.html

相关资源:高效SQL学习笔记
最新回复(0)