MySQL程序可以从配置文件中读取配置参数。配置文件提供了一种指定常用参数的方便方法,不用每次启动MySQL时在命令行输入参数。

可以使用以下命令查看MySQL服务读取的配置文件及顺序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ mysqld --verbose --help

mysqld Ver 8.0.34 for Linux on x86_64 (MySQL Community Server - GPL)

BuildID[sha1]=f183cd3ecfc35a4aa5da997063d5e8c97ffca986

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Starts the MySQL database server.

Usage: mysqld [OPTIONS]

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf /opt/mysql/my.cnf ~/.my.cnf

The following groups are read: mysql_cluster mysqld server mysqld-8.0
阅读全文 »

首先,需要安装PySide,如我本机在虚拟环境下安装的PySide6。安装完成后找到pyside6-uic.exe文件,如下图:

然后,在 PowerShell中执行以下命令完成转换:

1
PS D:\gitee\Scrat> .\.venv\Scripts\pyside6-uic.exe .\scrat.ui -o .\scrat.py

不一样。

需要特别注意 sudo rm -rf /* 这个操作危险至极,这个命令是将系统所有的东西都删除掉,如果有权限进行删除,系统下所有的东西都将被删除。

git reset --hard HEAD 是用于将你的工作目录重置回最后一次提交状态的命令。git reset 是 git 的一个命令,用于重置你当前的 HEAD 到指定的状态。

阅读全文 »

这个错误是我在本机启动Spark Standalone集群时出现的错误,如下:

1
2
3
4
5
6
$ ./sbin/start-all.sh 
starting org.apache.spark.deploy.master.Master, logging to /home/zhangjc/frin/spark/spark-3.5.1-bin-hadoop3/logs/spark-zhangjc-org.apache.spark.deploy.master.Master-1-frin.out
localhost: ERROR: Python with virtualenvwrapper module not found!
localhost: Either, install virtualenvwrapper module for the default python3 interpreter
localhost: or set VIRTUALENVWRAPPER_PYTHON to the interpreter to use.
localhost: starting org.apache.spark.deploy.worker.Worker, logging to /home/zhangjc/frin/spark/spark-3.5.1-bin-hadoop3/logs/spark-zhangjc-org.apache.spark.deploy.worker.Worker-1-frin.out

其实,这个错误跟Spark一点关系都没有。通过跟踪Spark启动脚本,发现在 sbin/workers.sh 中有以下代码:

阅读全文 »

JupyterLab使用SQLAlchemy访问MySQL时出现以下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[7], line 2
1 from sqlalchemy import create_engine
----> 2 engine = create_engine("mysql://scrat:scrat%40123@127.0.0.1/scrat")

File <string>:2, in create_engine(url, **kwargs)

File ~/frin/python/venvs/jupyter/lib/python3.12/site-packages/sqlalchemy/util/deprecations.py:281, in deprecated_params.<locals>.decorate.<locals>.warned(fn, *args, **kwargs)
274 if m in kwargs:
275 _warn_with_version(
276 messages[m],
277 versions[m],
278 version_warnings[m],
279 stacklevel=3,
280 )
--> 281 return fn(*args, **kwargs)

File ~/frin/python/venvs/jupyter/lib/python3.12/site-packages/sqlalchemy/engine/create.py:599, in create_engine(url, **kwargs)
597 if k in kwargs:
598 dbapi_args[k] = pop_kwarg(k)
--> 599 dbapi = dbapi_meth(**dbapi_args)
601 dialect_args["dbapi"] = dbapi
603 dialect_args.setdefault("compiler_linting", compiler.NO_LINTING)

File ~/frin/python/venvs/jupyter/lib/python3.12/site-packages/sqlalchemy/dialects/mysql/mysqldb.py:147, in MySQLDialect_mysqldb.import_dbapi(cls)
145 @classmethod
146 def import_dbapi(cls):
--> 147 return __import__("MySQLdb")

ModuleNotFoundError: No module named 'MySQLdb'

这是因为SQLAlchemy连接MySQL默认驱动是MySQLdb,MySQLdb仅支持Python2,不支持Python3。如果使用Python3,可以安装pymysql库,并将连接串改为mysql+pymysql://scrat:scrat%40123@127.0.0.1/scrat就好了。

阅读全文 »

这个问题自己也思考了很久,也阅读了一些书籍。根据个人的理解简单总结就是被动收入大于日常消费就可以实现财务自由。所以,财务自由是一个相对的概念,不是一个绝对概念。并不是说你是实现了一个小目标就财务自由了,你每个月的收入只有一两千就不自由。

这里有两点需要特别注意。

其一是被动收入。所谓被动收入通俗的一种说法就是睡大觉也能够赚到的收入。像工资、稿酬等需要投入身心赚的辛苦钱不是被动收入;像存款利息、房租收入可以算是被动收入。有些人认为理财属于被动收入,其实不准确,需要看理财的类型。像前文提到的存款利息,尤其是大行的存款,安全性非常高,不需要花费精力大理,这些无疑是被动收入;像股票这种需要花费大量精力学习、研究才能赚取的收益就不能算是被动收入。

阅读全文 »

原文

出自《墨子》耕柱篇。

巫马子谓子墨子曰:​“子兼爱天下,未云利也;我不爱天下,未云贼也。功皆未至,子何独自是而非我哉?​”子墨子曰:​“今有燎者于此,一人奉水将灌之,一人掺火将益之,功皆未至,子何贵于二人?​”巫马子曰:​“我是彼奉水者之意,而非夫掺火者之意。​”子墨子曰:​“吾亦是吾意,而非子之意也。​”

阅读全文 »

以下三种方法可以查看系统版本或内核版本,可以选择使用。

方法一:查看系统文件

1
2
3
4
5
6
7
8
9
$ cat /etc/os-release 
PRETTY_NAME="Deepin 20.9"
NAME="Deepin"
VERSION_ID="20.9"
VERSION="20.9"
VERSION_CODENAME="apricot"
ID=Deepin
HOME_URL="https://www.deepin.org/"
BUG_REPORT_URL="https://bbs.deepin.org/"
阅读全文 »

首先,检查pdsh的Rcmd type配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ pdsh -q -w localhost
-- DSH-specific options --
Separate stderr/stdout Yes
Path prepended to cmd none
Appended to cmd none
Command: none
Full program pathname /usr/bin/pdsh
Remote program path /usr/bin/pdsh

-- Generic options --
Local username zhangjc
Local uid 1000
Remote username zhangjc
Rcmd type rsh


one ^C will kill pdsh No
Connect timeout (secs) 10
Command timeout (secs) 0
Fanout 32
Display hostname labels Yes
Debugging No

-- Target nodes --
localhost

从配置项中可以看到Rcmd type为rsh,应该配置为ssh。在 .bashrc 中添加环境变量:

阅读全文 »
0%