赞
踩
yum install -y wget perl net-tools libtirpc
# 安装wget和perl、net-tools、libtirpc
wget https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.0-1.el9.x86_64.rpm-bundle.tar
# 下载安装包
tar -xvf mysql-8.4.0-1.el9.x86_64.rpm-bundle.tar
# 解压安装包
rpm -ivh mysql-community-common-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-client-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-libs-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-server-8.4.0-1.el9.x86_64.rpm
# 安装MySQL
systemctl start mysqld
# 启动数据库
systemctl enable mysqld
# 设置开机启动
cat /var/log/mysqld.log
# 查看下默认密码
如图:
mysql -uroot -p
# 进入数据库
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Hadesr^000';
#修改下root初始密码,密码为:Hadesr^000
FLUSH PRIVILEGES;
# 刷新下权限
exit
# 退出
mysql -uroot -pHadesr^000
# 再重新进入,就需要新密码了
CREATE USER 'Hadesr'@'localhost' IDENTIFIED BY 'Hadesr^000';
# 创建用户 Hadesr
如果需要外部远程访问,需要把
'Hadesr'@'localhost'
改成'Hadesr'@'%'
create database wifite character set utf8 collate utf8_bin; # 创建 wifite 数据库 GRANT ALL PRIVILEGES ON wifite.* TO 'Hadesr'@'localhost'; # wifite数据库用户赋权 FLUSH PRIVILEGES; # 刷新下权限 SHOW DATABASES; # 查看数据库中的所有数据库 ---------------------- mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | wifite | +--------------------+ 5 rows in set (0.00 sec)
wifite.*
为数据库名字,这里只把wifite
库授权给Hadesr
用户,库名改成*.*
,则把所有库都授权给Hadesr
用户
USE wifite;
CREATE TABLE `dever` (
`name` text NOT NULL,
`ip` varchar(15) NOT NULL,
`username` text NOT NULL,
`password` text NOT NULL,
`port` char(32)
) ;
show tables; # 查询 wifite 库中表 --------------------- mysql> show tables; +--------------------+ | Tables_in_wifite | +--------------------+ | dever | +--------------------+ select * from dever; # 查询 net_dev 表结构 ---------------------------------------------------------------------------- mysql> select * from dever; +------+----------+----------+------------+------+ | name | ip | username | password | port | +------+----------+----------+------------+------+ | Test | 10.1.2.3 | Hadesr | hadesr.com | 22 | +------+----------+----------+------------+------+
INSERT INTO `dever`(`name`,`ip`,`username`,`password`,`port`) VALUES ('Test','10.1.2.3','Hadesr','123456','22');
delete from dever where name = "Test";
update wifite.dever set password='hadesr.com' where name='Test';
Navicat Premium
编辑设备信息
MySQL
下插入设备信息命令繁琐,设备多了不方便,可以使用Navicat Premium
图形化进行操作
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。