------2023.02.07
编译链接了<mysql/mysql.h>的程序,需要安装libmysql++-dev
-
没有安装libmysql++-dev,在编译时报错没有找到库文件
-
提示:要是libmysql++-dev,而不是libmysql++,不然无济于事(至少我遇到的是这样,大伙可以自己研究)
[Ubuntu]Access denied for user ‘root’@‘localhost’ (using password: NO)
根据[网上的方法](Linux中连接MySQL出现“Access denied for user ‘root‘@‘localhost‘ (using password: NO)”_linux access denied for user ‘root’@‘localhost’ (u_测试小白的晋级之路的博客-CSDN博客) 我找不到/etc/my.cnf,于是我选择直接重启MySQL,但是输入 service mysqld restart
后 Failed to restart mysqld.service: Unit mysqld.service not found.
最后找到可以用chkconfig -list 检查系统中的各种服务。
But!chkconfig 是红帽系下的命令,在ubuntu 中需要用其它的命令代替,即 sysv-rc-conf
-
若直接
apt install sysv-rc-conf
后报错“E: Unable to locate package sysv-rc-conf“
,那就需要添加apt源终端输入
sudo vim /etc/apt/sources.list
在文件的最后一行添加
# 建议要做好注解,如下一行 # sysv-rc-conf deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
-
终端输入(更新源)
sudo apt update sudo apt upgrade
-
终端输入
sudo apt install sysv-rc-conf
至此就可以直接使用 sudo sysv-rc-conf
了(按quit 退出)
也可以将其复制一份,并命名为chkconfig,后续即可利用chkconfig 执行
cp /usr/sbin/sysv-rc-conf /usr/sbin/chkconfig
在chkconfig 后发现并没有mysqld 的服务,只有一个mysql(line 20) 的服务
acpid 2:on 3:on 4:on 5:on
alsa-utils 0:off 1:off 6:off S:on
anacron 2:on 3:on 4:on 5:on
apache-htcac 0:off 1:off 2:off 3:off 4:off 5:off 6:off
apache2 0:off 1:off 2:on 3:on 4:on 5:on 6:off
apparmor S:on
apport 2:on 3:on 4:on 5:on
avahi-daemon 0:off 1:off 2:on 3:on 4:on 5:on 6:off
bluetooth 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cron 2:on 3:on 4:on 5:on
cups 1:off 2:on 3:on 4:on 5:on
cups-browsed 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dbus 2:on 3:on 4:on 5:on
dns-clean S:on
gdm3 0:off 1:off 2:on 3:on 4:on 5:on 6:off
grub-common 2:on 3:on 4:on 5:on
irqbalance 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kerneloops 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kmod S:on
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network-mana
networking 0:off 6:off S:on
plymouth 0:off 2:on 3:on 4:on 5:on 6:off
plymouth-log S:on
pppd-dns S:on
procps S:on
rpcbind 0:off 1:off 6:off S:on
rsync 2:on 3:on 4:on 5:on
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
saned 0:off 1:off 2:on 3:on 4:on 5:on 6:off
speech-dispa 0:off 1:off 2:on 3:on 4:on 5:on 6:off
spice-vdagen 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ssh 2:on 3:on 4:on 5:on
udev S:on
ufw 1:off S:on
unattended-u 0:off 2:on 3:on 4:on 5:on 6:off
uuidd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
whoopsie 1:off 2:on 3:on 4:on 5:on
x11-common S:on
于是我就试着 service mysql restart
,然后再次进入数据库,成功!