启动 mysql:8.* 效果很好,但 mysql:5.7.* 会导致立即 100% 内存消耗,尝试通过以下方法解决。
- 编辑
/lib/systemd/system/containerd.service
,修改LimitNOFILE=infinity
为LimitNOFILE=1048576
- sudo systemctl daemon-reload
- sudo systemctl restart containerd.service
再尝试启动 mysql 容器。
启动 mysql:8.* 效果很好,但 mysql:5.7.* 会导致立即 100% 内存消耗,尝试通过以下方法解决。
/lib/systemd/system/containerd.service
,修改 LimitNOFILE=infinity
为 LimitNOFILE=1048576
再尝试启动 mysql 容器。
前提是安装了 android studio,在 linux 中,使用以下命令:
~/Android/Sdk/build-tools/33.0.2/aapt dump <app.apk>
其中,33.0.2
要改成自己实际的版本。
找到 dbeaver 的执行位置,查看它的安装位置:
$ which dbeaver
/usr/bin/dbeaver
$ cat /usr/bin/dbeaver
export GTK_OVERLAY_SCROLLING=0
/usr/lib/dbeaver/dbeaver $@
进入 /usr/lib/dbeaver/
目录,编辑 dbeaver.ini
,在 -vmargs
上面,添加以下内容:
-vm
/usr/lib/jvm/java-17-openjdk/bin
注意:确保已经安装了dbeaver指定的 jre/jdk 版本,并获取其目录。
To configure the restart policy for a container, use the --restart
flag when using the docker run
command. The value of the --restart
flag can be any of the following:
Flag | Description |
---|---|
no | Do not automatically restart the container. (the default) |
on-failure[:max-retries] | Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the :max-retries option. |
always | Always restart the container if it stops. If it is manually stopped, it is restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in restart policy details) |
unless-stopped | Similar to always , except that when the container is stopped (manually or otherwise), it is not restarted even after Docker daemon restarts. |
参考:https://docs.docker.com/config/containers/start-containers-automatically/
用记事本打开 vmx
文件,在文件最后添加以下内容:
monitor_control.restrict_backdoor = "TRUE"
保存文件后,再次启动虚拟机即可。
参考:https://developer.aliyun.com/article/536362
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
提示信息可能像这样:
Could not connect 'Ethernet0' to virtual network '/dev/vmnet0'. More information can be found in the vmware.log file.
Failed to connect virtual device 'Ethernet0'.
尝试以下操作:
sudo systemctl restart vmware-networks
# 61 改为自己的版本
yay -S linux61 linux61-headers
重启后再试。
sudo touch /etc/vmware/x && sudo vmware-networks --migrate-network-settings /etc/vmware/x && sudo rm /etc/vmware/x && sudo modprobe vmnet && sudo vmware-networks --start
参考:
尝试使用以下方法解决:
/etc/default/grub
,找到 GRUB_CMDLINE_LINUX_DEFAULT
,在尾部添加 ibt=off
。sudo update-grub
参考:https://wiki.archlinux.org/title/VirtualBox
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use PDO;
class TestController extends Controller
{
public function index()
{
$pdo = DB::getPdo();
$int = 1;
$res = 0;
$stmt = $pdo->prepare("EXEC dbo.test :int,:res");
$stmt->bindParam(':int', $res, PDO::PARAM_INT);
$stmt->bindParam(':res', $res, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 400);
$stmt->execute();
dd($res);
}
}
参考:
tp5 需要修改原码才可以使用:
catch (\PDOException $e)
内,修改为如下代码:if ($procedure == true) { return; } elseif ($this->isBreak($e)) { return $this->close()->query($sql, $bind, $master, $pdo); }
控制器执行:
<?php
namespace app\api\controller;
use PDO;
use think\Db;
class Test extends Common {
public function index() {
$int = 1;
$res = 1;
Db::query('exec test :int,:res', [
'int' => $int,
'res' => [&$res, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 4000],
]);
print_r($res);
}
}
参考:
以上示例使用的存储过程如下:
ALTER PROC [dbo].[test]
-- 创建:CREATE PROC [dbo].[test]
@IntInput int,
@StrResult varchar(20) out
as
begin
if (@IntInput>1)
Set
@StrResult = '>1'
else
Set
@StrResult = '<=1'
end
SQL 执行:
declare @strResult varchar(20)
exec test -1,@strResult output
print @strResult
# 安装不同的版本
yay -S jdk11-openjdk
# 查看已经安装的版本
archlinux-java status
# 切换版本
sudo archlinux-java set java-11-openjdk