mysql常见错误

错误一:mysql(mariadb): unknown variable 'character_set_server=utf8'
在mariadb里面设置字符编码的时候,client和server还不太一样,下如下这样设置就可以了

[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
 

错误二:MySQL ERROR 1005: Can't create table (errno: 150)
1、外键的引用类型不一样,如主键是int外键是char
2、找不到主表中引用的列
3、主键和外键的字符编码不一致,也可能存储引擎不一样

错误三:The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
在导出数据到目录的时候会遇到上面的错误,具体的语句为:
SELECT * FROM ciika INTO OUTFILE '/tmp/ciika.txt';
可以修改my.ini或者直接导出到mysql的目录
mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| /var/lib/mysql-files/ |
+---------------------------+
修改语句为:SELECT * FROM ciika INTO OUTFILE '/var/lib/mysql-files/ciika.txt';

错误四:SQLyog连接数据库报错plugin caching_sha2_password could not be loaded
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则 

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码 

FLUSH PRIVILEGES; #刷新权限

上面三个都需要执行,亲测可用

错误五:mysql5.7无法绑定0.0.0.0,一直是127.0.0.1
原因是由于mysql5.7修改了配置的地址/etc/mysql/mysql.conf.d/
修改后重启,然后可以看到netstat -ntpl | grep 3306 就是正确的了

pip配置国内镜像下载python包[转载]

pip install下载Python安装包总是出错,国内的网络访问python官网有些吃力。清华大学提供开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/

pypi 镜像每 5 分钟同步一次。

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

注意,simple 不能少, 是 https 而不是 http

Base64算法过程解析以及优缺点

base64的优点
1.支持广泛,平台和语言支持都比较广泛,浏览器绝大多数都支持,直接可在前端编解码,很多加密算法的都有base64的应用。
2.在小图片base64后,可以减少请求,在某些场景下用途很大。
3.有些情况下传输不可见字符不方便,base64后都是可见字符。
4.能直接把二进制文件变成字符传输。
base64的缺点
1.他的编码方式注定会有三分之一的冗余
base64的实现
Base-64编码将一个8位子节序列拆散为6位的片段,并为每个6位的片短分配一个字符,这个字符是Base-64字母表中的64个字符之一。这64个输出字符都是很常见的,可以安全地放在HTTP首部字段中。这64个字符中包括大小写字母、数字、+和/,还是用里特殊字符=。base64编码收到一个8位字节序列,将这个二进制序列流划分成6位的块。二进制序列有时不能正好平均地分为6位的块,在这种情况下,就在序列末尾填充零位,使二进制序列的长度成为24的倍数(6和8的最小公倍数),对已填充的二进制进行编码时,任何完全填充(不包括原始数组中的位)的6位组都有特殊的第65个符号"="表示。如果6位组是部分填充的,就将填充位设置为0.
转换过程:
转前:ciika

转前 ascii十进制 二进制 8位变6位 高位补0 十进制 索引表
c 99 01100011 011000 00011000 24 Y
i 105 01101001 110110 00110110 54 2
i 105 01101001 100101 00100101 37 l
k 107 01101011 101001 00101001 41 p
a 97 01100001 011010 00011010 26 a
110110 00110110 54 2
000100 00000100 4 E

8位变6位示意图:qq%e5%9b%be%e7%89%8720161203133423
5个字母乘以8位等于40位,8和6最小的公倍数是48,即还需要48-40=8位,最后一个低位补两个0,最后6位全是0,用=号代替,所以ciika最终的base64编码是Y2lpa2E=

 

base64的在开发中遇到的问题
在url中+号会被转义,在BASE64的基础上进行一下的编码:去除尾部的"=",把"+"替换成"-",把"/"替换成"_"
在实际开发过程中,在AES加密后,会产生+/=等,如果万一需要通过get传输,需要做一些转换
"ciika".replace(/\+/g, "%2B").replace(/\&/g, "%26");
案例
这是一个真实的案例,大概需要是这样的,需要对用户的文件进行加密,然后进行还原,采用的大概算法是对原始字符采用占位,采用二叉树的思想,最中间位首字母,左树是真实字母,右边为混淆,依次采用左右交叉存放,最后在针对整个字符串base64或者在每一位混淆的均采用base64的索引编码。如图所示
webwxgetmsgimg

附件:

Base64编码索引表

索引
对应字符
0
A
1
B
2
C
3
D
4
E
5
F
6
G
7
H
8
I
9
J
10
K
11
L
12
M
13
N
14
O
15
P
16
Q
17
R
18
S
19
T
20
U
21
V
22
W
23
X
24
Y
25
Z
26
a
27
b
28
c
29
d
30
e
31
f
32
g
33
h
34
i
35
j
36
k
37
l
38
m
39
n
40
o
41
p
42
q
43
r
44
s
45
t
46
u
47
v
48
w
49
x
50
y
51
z
52
0
53
1
54
2
55
3
56
4
57
5
58
6
59
7
60
8
61
9
62
+
63
/

ascii对应表

ASCII值 控制字符
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z

 

安卓部分应用包名(android packagename list)

在做一个项目的时候,需要安卓的的应用包名作为测试数据,在网上找了很久都没有,程序上线后,我收集了一些样本包名,可以拿去做测试,这里大概有2W左右的数据,androidpackagelist详细的请下载这个zip包里面的数据。或者http://ciika.com/wp-content/uploads/2016/12/androidpackagelist.zip

con.bluetooth.lock
com.wifi.lock
com.android.settings
com.android.vending
com.google.android.gm
com.google.android.apps.maps
com.google.android.youtube
com.google.android.googlequicksearchbox
com.whatsapp
com.android.contacts
com.android.chrome
com.android.mms
com.google.android.apps.docs
com.google.android.talk
com.android.calendar
com.google.android.gms
com.google.android.music
com.android.stk
com.facebook.orca
com.google.android.videos
com.facebook.katana
com.android.email
com.lenovo.anyshare.gps
com.android.providers.downloads.ui
com.google.android.play.games
com.google.android.apps.photos
com.mxtech.videoplayer.ad
com.android.calculator2
com.google.android.apps.plus
com.UCMobile.intl
com.android.deskclock
com.google.android.apps.magazines
com.android.soundrecorder
com.android.browser
com.sec.android.app.myfiles
com.sec.android.app.camera
com.sec.android.gallery3d
com.sec.android.app.clockpackage
com.sec.android.app.popupcalculator
com.android.gallery3d
com.google.android.apps.books
com.android.dialer
com.sec.android.app.samsungapps
com.imo.android.imoim
com.truecaller
com.instagram.android
com.sec.android.app.fm
cn.xender
com.sec.android.app.sbrowser
com.jio.myjio
com.android.music
com.samsung.android.app.memo
com.skype.raider
com.samsung.android.sm
com.sec.android.app.voicerecorder
com.nemo.vidmate
com.jio.jioplay.tv
com.cleanmaster.mguard
com.jio.join
com.bsb.hike
com.facebook.lite
com.flipkart.android
in.startv.hotstar
com.mediatek.filemanager
com.android.stk2
com.mediatek.videoplayer
cn.wps.moffice_eng
com.google.android.calendar
com.opera.mini.native
com.sec.android.app.voicenote
com.samsung.android.video
com.twitter.android
in.amazon.mShop.android.shopping
devian.tubemate.home
com.picsart.studio
com.sec.android.app.music
com.jio.media.ondemand
com.king.candycrushsaga
com.uc.browser.en
com.microsoft.office.word
com.google.android.street
com.google.android.apps.translate
com.microsoft.skydrive
com.mediatek.datatransfer
com.microsoft.office.excel
com.mediatek.FMRadio
com.google.android.apps.genie.geniewidget
com.opera.max.oem
com.sec.android.autobackup
com.microsoft.office.powerpoint
org.videolan.vlc
net.one97.paytm
com.mygalaxy
com.dropbox.android
com.android.camera2
com.microsoft.office.onenote
com.samsung.everglades.video
com.mediatek.StkSelection
com.jio.media.jiobeats
com.adobe.reader
com.commsource.beautyplus
com.tencent.mm
com.samsung.android.email.provider
jp.naver.line.android
com.kiloo.subwaysurf
com.appstar.callrecorder
com.mobile.indiapp
com.snapdeal.main
com.google.android.keep
com.evernote
com.vlingo.midas
com.qihoo.security
com.samsung.android.email.ui
com.cyberlink.youperfect
flipboard.app
com.mediatek.fmradio
com.lenovo.leos.cloud.sync.row
com.android.camera
com.sec.android.app.shealth
com.surpax.ledflashlight.panel
com.lbe.parallel.intl
com.bbm
com.jiochat.jiochatapp
com.eterno
com.mediatek.todos
com.linecorp.b612.android
com.cleanmaster.security
com.supercell.clashofclans
com.opera.mini.android
com.jio.mhood.jionet
com.sec.chaton
com.samsung.video
com.springwalk.mediaconverter
com.joeware.android.gpulumera
com.viber.voip
com.android.quicksearchbox
com.samsung.helphub
com.route66.maps5
com.atomic.apps.ringtone.cutter
com.caf.fmradio
com.domobile.applock
com.estrongs.android.pop
com.ubercab
com.olx.southasia
com.google.android.apps.docs.editors.docs
com.roidapp.photogrid
com.dianxinos.dxbs
com.google.android.deskclock
com.corpay.mwallet
com.lenovo.ideafriend
com.touchtype.swiftkey
com.jio.media.jioxpressnews
com.reliancejio.mobilesecurity
com.jio.media.jiomags
com.appsomniacs.da2
com.sec.pcw
com.samsung.groupcast
com.saavn.android
com.cricbuzz.android
com.android.fmradio
com.google.android.launcher
com.dianxinos.optimizer.duplay
com.lenovo.FileBrowser
com.lenovo.serviceit
com.google.android.apps.inputmethod.hindi
com.quvideo.xiaoying
com.imangi.templerun2
com.devuni.flashlight
com.motorola.genie
com.thunderst.radio
jio.cloud.drive
org.videolan.vlc.betav7neon
com.sprd.fileexplorer
com.venticake.retrica
com.mobisystems.office
com.intsig.camscanner
vStudio.Android.Camera360
com.wingtech.calc
com.king.candycrushsodasaga
com.neuralprisma
com.wingtech.filemanager
HinKhoj.Dictionary
com.snapchat.android
com.cyberlink.youcammakeup
com.tripadvisor.tripadvisor
com.mediatek.notebook
com.myairtelapp
com.motorola.fmplayer
com.olacabs.customer
cn.andouya
com.internet.speed.meter.lite
com.myntra.android
com.cam001.selfie
org.telegram.messenger
com.android.videoeditor
com.sec.android.app.translator
com.adobe.flashplayer
com.google.android.apps.docs.editors.sheets
com.pipcamera.activity
com.sprd.note
com.android.systemui
com.lenovo.xlauncher
com.oppo.camera
com.cyanogenmod.eleven
com.nearme.themespace
com.oppo.music
com.motorola.camera
com.emoji.keyboard.touchpal
com.motorola.MotGallery2
com.wingtech.fmradio
com.dewmobile.kuaiya.play
com.google.android.apps.docs.editors.slides
com.samsung.android.app.episodes
sun.way2sms.hyd.com
com.gamestore
com.lenovo.videoplayer
com.lenovo.scg
com.lenovo.themecenter
com.lenovo.fm
com.bt.bms
com.dolby.daxappUI
com.sam.apps.magazines.widget
com.yahoo.mobile.client.android.mail
com.motorola.moto
com.lenovo.deskclock
com.freecharge.android
com.android.launcher3
com.lenovo.recorder
com.sonyericsson.music
com.balancehero.truebalance
com.lenovo.phoneguide
com.lenovo.compass
com.sec.android.app.memo
com.android.cellbroadcastreceiver
io.teslatech.callbreak
com.micromax
com.sec.everglades
com.guvera.android
com.quickoffice.android
com.jb.emoji.gokeyboard
sg.bigo.live
com.sonyericsson.album
com.bsbportal.music
com.gionee.filemanager
jlzn.com.android.compass
com.mobisystems.fileman
com.CultureAlley.japanese.english
com.netqin.ps
com.gionee.change
com.uc.iflow
com.fingersoft.hillclimb
com.gionee.flashlight
com.gionee.note
com.shazam.android
com.fundevs.app.mediaconverter
com.android.updater
com.android.thememanager
com.coolwind.weather
com.amazon.kindle
com.sonyericsson.android.camera
com.oppo.weather
com.oppo.filemanager
com.oppo.gallery3d
oppo.multimedia.soundrecorder
com.oppo.backuprestore
com.oppo.alarmclock
com.miui.compass
com.sonyericsson.organizer
com.oppo.video
com.miui.weather2
com.miui.securitycenter
com.xiaomi.account
com.nearme.ocloud
com.lenovo.gallery
com.miui.gallery
com.android.fileexplorer
com.imo.android.imoimbeta
com.sonyericsson.android.socialphonebook
com.miui.notes
com.miui.player
com.sonyericsson.conversations
com.sec.android.widgetapp.diotek.smemo
com.sonyericsson.extras.liveware
com.gionee.video
com.gionee.softmanager
com.sec.android.mimage.photoretouching
com.android.providers.downloads
com.sonyericsson.video
com.antivirus
com.google.android.apps.messaging
com.wsandroid.suite
gn.com.android.update
com.gionee.gallery
com.ril.ajio
com.infraware.docmaster
com.htc.android.htcsetupwizard
org.mozilla.firefox
com.lionmobi.powerclean
com.motorola.bodyguard
gn.oversea.onlinewallpaper
com.miniclip.eightballpool
com.gionee.gamehall
com.asus.microfilm
livio.pack.lang.en_US
com.qihoo.security.lite
com.outfit7.mytalkingtomfree
com.dolby.ds1appUI
com.gionee.telepath
com.utorrent.client
com.sonyericsson.xhs
com.nextwave.wcc2
com.sonymobile.sketch
com.miui.fm
com.oppo.compass
com.cube26.trendingnow
org.zwanoo.android.speedtest
com.samsung.voiceserviceplatform
com.samsung.android.snote
com.example.android.notepad
com.cyworld.camera
com.google.android.apps.tachyon
net.megawave.flashalerts
com.cyanogenmod.filemanager
com.oppo.virusscan
com.samsung.android.app.pinboard
com.shopclues
com.turboc.cleaner
com.snaptube.premium
com.sonyericsson.fmradio
com.gametion.ludo
com.mediatek.systemupdate
com.quikr
com.lenovo.anyshare
com.lyrebirdstudio.montagenscolagem
com.pixlr.express
free.mobile.internet.data.recharge
com.oppo.safe
com.asus.filemanager
com.rock.gota
com.gau.go.launcherex
com.alibaba.aliexpresshd
com.sbi.SBIFreedomPlus
com.sprd.appbackup
com.chaatz
com.sonyericsson.trackid
sstream.app
com.mventus.selfcare.activity
com.linkedin.android
com.gaana
com.amigo.chameleon
com.sec.android.mimage.sstudio
com.hideitpro
com.miui.barcodescanner
com.bonbon.ttfHD
com.ansangha.drdriving
com.sonymobile.helpapp7
com.rsupport.rs.activity.rsupport.aas2
com.sonymobile.entrance
com.avast.android.mobilesecurity
tv.peel.samsung.app
com.android.phone
com.irctc.main
com.huawei.KoBackup
cris.icms.ntes
com.opera.browser
com.android.stk1
com.disney.TempleRunOz.goo
com.huawei.hidisk
com.waze
com.instagram.layout
com.cmcm.locker
com.sgiggle.production
com.wantu.activity
com.huawei.android.totemweather
com.tv.v18.viola
com.huawei.android.hwouc
com.sony.nfx.app.sfrc
com.sec.android.app.videoplayer
com.meitu.makeup
com.mobilemotion.dubsmash
com.gionee.antithefttrack
com.mobond.mindicator
com.mxtech.videoplayer.pro
mobi.infolife.appbackup
com.gameloft.android.GloftSMIM
com.mmt.intex.servicecenter
com.soundcloud.android
com.google.earth
com.lyrebirdstudio.collage
com.hq.flashlight
com.qisiemoji.inputmethod
com.sec.android.usermanual
com.android.voicedialer
com.sec.android.app.gamehub
com.samsung.android.app.watchmanager
com.cmcm.whatscall
com.miui.bugreport
com.skgames.trafficrider
com.vc.browser
com.gameloft.android.GloftBUB3
com.asus.flashlight
net.zedge.android
com.thinkyeah.galleryvault
com.gameloft.android.gdc
com.gionee.kidshome
com.mobikwik_new
org.codeaurora.snapcam
com.broadcom.torch
com.wingtech.compass
com.android.filemanager
com.android.BBKClock
com.android.bbkcalculator
com.bbk.calendar
com.iqoo.secure
com.android.bbkmusic