重置DirectAdmin安装的Mysql的Root密码,并运行Mysql_secure_installation

DirectAdmin默认会安装WEB环境,装完的MYSQL没有给我们root密码,没法直接运行mysql_secure_installation。怎么办呢?

以下就是解决办法:

1.获得directadmin的mysql管理员密码。

路径是/usr/local/directadmin/conf/mysql.conf

2.利用mysql已经创建的MYSQL管理员账户重置ROOT密码。

mysql -u da_admin -p

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘newpass’);

3.运行mysql_secure-installation

会提示输入root密码,输入你刚刚重置的密码即可。

PS:转载请注明出处,谢谢!

Debian/Ubuntu更换网卡换IP完美解决方案

第一步:修改网卡信息

 

修改文件/etc/udev/rules.d/z25_persistent-net.rules 文件,原来为:

protime-linux:/etc/udev/rules.d# cat z25_persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# MAC addresses must be written in lowercase.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:15:3a:48″, NAME=”eth0″
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:15:3a:52″, NAME=”eth1″
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:af:1c:c7″, NAME=”eth2″

修改后:

protime-linux:/etc/udev/rules.d# cat z25_persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# MAC addresses must be written in lowercase.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:15:3a:48″, NAME=”eth2″
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:15:3a:52″, NAME=”eth1″
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==”net”, DRIVERS==”?*”, ATTRS{address}==”00:0c:29:af:1c:c7″, NAME=”eth0″

保存重启后可以看到原来的网络配置又回来了。
第二部:修改IP
debian的IP地址信息的文件是保存在/etc/network/interfaces,直接编辑该文件就可以。

#可以看到文件中的设置为动态IP的语句
iface eth0 inet dhcp

当然也可以设置为静态IP地址,如:

在 /etc/network/interfaces 中,删除 iface eth0 inet dhcp,添加一下内容

iface eth0 inet static
address 172.17.10.40
netmask 255.255.0.0
broadcast 172.17.0.255
network 172.17.0.0
gateway 172.17.10.100

重启网络
#/etc/init.d/networking restart