JiaHe

相遇即是缘

环境

  • mysql 8.0

  • Django 3.2

(No changes detected)及解决

问题情景

# 迁移数据库
python manage.py makemigrations
python manage.py migrate

报错

RuntimeWarning: Got an error checking a consistent migration history performed
for database connection 'default': (2059, <NULL>)
warnings.warn
(No changes detected)

原因分析

MySQL 8.x加密方式:caching_sha2_password
MySQL 5.x加密方式为:mysql_native_password
所以要改成mysql_native_password

修改方式

  1. 由cmd进入命令行

  2. 登录到mysql: mysql -u username -p password

    参数说明:[-u]后面接的是登录数据库的账号,[-p]后面是密码

    如果无法登录,可能的原因是环境变量中PATH变量没有加入MySQL的目录,可以添加环境变量或在开始菜单中找到MySQL 8.0 Command Line Client进行登录(这种方式打开后直接输入密码即可)。

  3. 查看你的账号加密方式

    use mysql                         
    select user,plugin from user
    mysql> use mysql
    Database changed
    mysql> select user,plugin from user;
    +------------------+-----------------------+
    | user | plugin |
    +------------------+-----------------------+
    | cyk | caching_sha2_password |
    | mysql.infoschema | caching_sha2_password |
    | mysql.session | caching_sha2_password |
    | mysql.sys | caching_sha2_password |
    | root | caching_sha2_password |
    +------------------+-----------------------+
  4. 输入下面的指令进行修改

    mysql> alter user '用户名'@'localhost' identified with mysql_native_password by '你的密码';

    再次查看

    mysql> select user,plugin from user;
    +------------------+-----------------------+
    | user | plugin |
    +------------------+-----------------------+
    | cyk | caching_sha2_password |
    | mysql.infoschema | caching_sha2_password |
    | mysql.session | caching_sha2_password |
    | mysql.sys | caching_sha2_password |
    | root | mysql_native_password |
    +------------------+-----------------------+

(2026, ‘SSL connection error:unknown error number‘) 及解决

问题情景

# 迁移数据库
python manage.py makemigrations
python manage.py migrate

报错
Windows下django.db.utils.OperationalError: (2026, ‘SSL connection error: unknown error number‘)

原因分析

较高版本的mysql的ssl默认是开启的

解决方案

关闭ssl

  1. 登录mysql之后,输入该命令:

    mysql> SHOW VARIABLES LIKE '%ssl%';
  2. 修改配置文件my.ini(可能要通过属性修改权限,否则无法修改成功)

    # 路径:C:\ProgramData\MySQL\MySQL Server 8.0
    [mysqld]
    skip_ssl # 忽略ssl
  3. 重启mysql服务

  4. 重新执行命令

    mysql> SHOW VARIABLES LIKE '%ssl%';

安装 python-ldap 包时出现错误,如下:

"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=3.4.4 "-DLDAPMODULE_AUTHOR=python-ldap project" "-DLDAPMODULE_LICENSE=Python style" -IModules -IC:\Users\jiahe\scoop\apps\python38\current\include -IC:\Users\jiahe\scoop\apps\python38\current\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcModules/LDAPObject.c /Fobuild\temp.win-amd64-cpython-38\Release\Modules/LDAPObject.obj
LDAPObject.c
C:\Users\jiahe\AppData\Local\Temp\pip-install-xhre2otp\python-ldap_7783ac0f126e44ddb07bd17f8f8f826f\Modules\common.h(15): fatal error C1083: 无法打开包括文件: “lber.h”: No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for python-ldap
Failed to build python-ldap
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (python-ldap)

https://github.com/cgohlke/python-ldap-build/releases下载对应版本的whl文件,然后通过pip install安装即可解决。

另外,在解决过程中发现,很多历史帖子,都提到了这个网站https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap ,但是它已经不对外了,难过😔。

分享一下自己的观影实践

面向群体:非新手,有一定实践经验
电视设备:小米电视S75(开启ADB、未知软件安装)
观影目标:看直播(CCTV、地方台)、看动漫、电视剧、电源等杂七杂八的盗版资源 😀

我是通过adb命令直接安装apk,adb install apk文件路径

注意事项:

  • 尝试adb connect时,如果提示未授权 unauthorized 类似的关键词,先尝试adb kill-server,再adb start-server,然后尝试连接,这个时候电视上会出现提示授权的弹窗,确认授权即可。
  • 使用Kodi中的IPTV观影时,强烈建议开启路由器的IPV6。

TVBox

软件下载:https://down.fongmi.eu.org/#download
直播源:https://ghp.ci/raw.githubusercontent.com/qist/tvbox/master/jsm.json

Kodi

软件下载:https://mirrors.kodi.tv/releases/android/arm
IPTV源:https://live.kilvn.com/iptv.m3u

我选择的是kodi-21.1-Omega-armeabi-v7a.apk

切换中文、安装IPTV插件等此类操作,建议Bing搜索一下,我就不赘述了。

Emby(尝试中)

软件下载: Release Android TV 2.0.95 破解版 · rartv/EmbyPublic
用户注册(时效限制): https://nomaba.com/get-user.html

建议使用临时邮箱注册

暂时没有找到特别丰富且免费的源

Bat脚本

reset_navicat.bat
@echo off

:: 针对navicat15
:: reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration14XCS /f

:: 针对navicat16,英文版用户需将 `NavicatPremium\Registration16XCS` 更改为 `NavicatPremium\Registration16XEN`
:: reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration16XCS /f

:: 针对navicat17
echo reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration17XCS /f
reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration17XCS /f

:: 通用
echo reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update /f
reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update /f

:: 备份CLSID,如果出现什么问题,请使用备份reg进行恢复
set filename=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
set "filename=%filename: =0%"
reg export HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID %HOME%\Desktop\CLSID%filename%.reg

setlocal enabledelayedexpansion

set dn=Info
set dn2=ShellFolder
set rp=HKEY_CURRENT_USER\Software\Classes\CLSID

for /f "tokens=*" %%a in ('reg query "%rp%"') do (

for /f "tokens=*" %%l in ('reg query "%%a" /f "%dn%" /s /e ^|findstr /i "%dn%"') do (
echo deleteing Info: %%a
reg delete %%a /f
)

for /f "tokens=*" %%l in ('reg query "%%a" /f "%dn2%" /s /e ^|findstr /i "%dn2%"') do (
set flag=false

for /f "tokens=*" %%k in ('reg query "%%l" /s') do (
set flag=true
)

if /i "!flag!"=="false" (
echo deleteing ShellFolder: %%a
reg delete %%a /f
)
)

)

pause

参考

简介

dnf 是基于 Red Hat Linux 发行版的下一代包管理工具,它代替 yum 提供更好的性能、更好的依赖处理和更好的模块化架构。

基础语法

dnf [options] [command] [package]
阅读全文 »