# 共享的 MySQL 通用文件,可能包括一些共享的配置文件等。这是 MySQL 安装的一部分,通常需要安装 rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm # MySQL 客户端插件,提供额外的功能和扩展。具体需要哪些插件取决于你的使用情况。你可以根据你的需要来决定是否安装这些插件。 rpm -ivh mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm # MySQL 库文件,用于在应用程序中连接到 MySQL 数据库。这是 MySQL 连接所必需的,通常需要安装 rpm -ivh mysql-community-libs-8.0.33-1.el7.x86_64.rpm # 共享的 MySQL 通用文件,可能包括一些共享的配置文件等。这是 MySQL 安装的一部分,通常需要安装 rpm -ivh mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm # MySQL 开发包,包含开发所需的头文件和库文件。如果你打算在该系统上开发与 MySQL 相关的应用程序,你需要安装此包 rpm -ivh mysql-community-devel-8.0.33-1.el7.x86_64.rpm # MySQL 客户端工具,用于连接和管理 MySQL 服务器。通常情况下,如果你计划从该系统上远程连接到其他 MySQL 服务器,你需要安装此包。如果你的系统不需要连接其他 MySQL 服务器,则可能不需要安装 rpm -ivh mysql-community-client-8.0.33-1.el7.x86_64.rpm # ICU 数据文件,用于支持国际化和字符集处理。如果你的应用程序不需要特定的国际化功能,则可能不需要安装 rpm -ivh mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm # MySQL 服务器,用于托管数据库实例。如果你计划在该系统上安装 MySQL 数据库服务器,你需要安装此包 rpm -ivh mysql-community-server-8.0.33-1.el7.x86_64.rpm
常用命令
启动
使用systemctl start mysqld命令启动服务器
rpm安装MySQL会自动生成一个随机密码,可以在/var/log/mysqld.log中查看
使用mysql -u root -p进入客户端
设置密码
连接MySQL之后,使用ALTER USER 'root'@'localhost' IDENTIFIED BY '123456789';修改密码
出现Your password does not satisfy the current policy requirements提示,意思是您的密码不符合当前规定的要求,你要么就把你的密码设置得复杂点,要么就去降低密码的校验规则。
在 Linux 上安装 MySQL 时会自动安装一个校验密码的插件,默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。修改密码时新密码是否符合当前的策略,不满足则会提示ERROR
可以将这个限制密码位数设小一点,复杂度类型调底一点
1 2 3 4
# 将密码复杂度校验调整简单类型 set global validate_password.policy = 0; # 设置密码最少位数限制为 4 位 set global validate_password.length = 4;
远程连接
可能遇到的问题
MySQL自身原因
MySQL默认不允许远程连接,修改配置
使用mysql -u root -p链接服务器
show databases;查看当前所有数据库
use mysql;进入mysql数据库(配置mysql的一个数据库)
select user,host from user;查看用户的链接方式
使用update user set host='%' where user='root';将root的链接方式修改为%
classMyContext: def__enter__(self): print("Entering the context") return self
def__exit__(self, exc_type, exc_value, traceback): """ exc_type: 异常类型,如果没有异常则为None exc_value: 异常值,如果没有异常则为None traceback: 追溯信息,如果没有异常则为None """ print("Exiting the context") if exc_type isnotNone: print(f"An exception of type {exc_type} occurred with value {exc_value}") returnFalse# Return True if you want to suppress the exception
# 使用with语句创建上下文管理器 with MyContext() as context: print("Inside the context")
print("Outside the context")
输出
1 2 3 4
Entering the context Inside the context Exiting the context Outside the context
defgive_me_the_bigger_one(num0: Union[int, float], num1: Union[int, float]) -> Union[int, float]: iftype(num0) != type(num1): raise ValueError(f"The two number {num0} and {num1} must have the same type!") if num0 > num1: return num0 else: return num1
defgive_me_the_bigger_one(num0: T, num1: T) -> T: iftype(num0) != type(num1): raise ValueError(f"The two number {num0} and {num1} must have the same type!")
if num0 > num1: return num0 else: return num1
T = TypeVar("T")表示定义了一个泛型类型变量T,并没有指定他的类型上限,也就是说传给这个函数的参数可以是任意类型
# PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec
# pyenv # For a library or package, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: # .python-version
# pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock
# poetry # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control #poetry.lock
# pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. #pdm.lock # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # in version control. # https://pdm.fming.dev/#use-with-ide .pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/
# PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/
# This .gitignore file should be placed at the root of your Unity project directory # # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore # /[Ll]ibrary/ /[Tt]emp/ /[Oo]bj/ /[Bb]uild/ /[Bb]uilds/ /[Ll]ogs/ /[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size. # They also could contain extremely sensitive data /[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored !/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin # /[Aa]ssets/AssetStoreTools*
## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html
# Click-Once directory publish/
# Publish Web Output *.[Pp]ublish.xml *.azurePubxml # Note: Comment the next line if you want to checkin your web deploy settings, # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to # checkin your Azure Web App publish settings, but sensitive information contained # in these scripts will be unencrypted PublishScripts/
# NuGet Packages *.nupkg # NuGet Symbol Packages *.snupkg # The packages folder can be ignored because of Package Restore **/[Pp]ackages/* # except build/, which is used as an MSBuild target. !**/[Pp]ackages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/[Pp]ackages/repositories.config # NuGet v3's project.json files produces more ignorable files *.nuget.props *.nuget.targets
# Microsoft Azure Build Output csx/ *.build.csdef
# Microsoft Azure Emulator ecf/ rcf/
# Windows Store app package directories and files AppPackages/ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt *.appx *.appxbundle *.appxupload
# Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache !?*.[Cc]ache/
# Including strong name files can present a security risk # (https://github.com/github/gitignore/pull/2483#issue-259490424) #*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #bower_components/
# RIA/Silverlight projects Generated_Code/
# Backup & report files from converting an old project file # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm ServiceFabricBackup/ *.rptproj.bak