Linux-Mariadb-Install
Linux-mariadb-Install
-
搜索
1
2# 搜索的作用: 显示可安装程序包
yum search mariadb -
安装
1
yum install -y mariadb mariadb-server
-
启动服务
1
systemctl start mariadb # 3306 端口
-
查看端口号是否被占用
1
2
3netstat -nap | grep 3306
mysqld # MYSQL Daemon -
登录数据库
1
2
3
4
5
6mysql -u root -p # 按两下回车,
跳过密码
# 显示所有数据库
show databases;
# 使用数据库
use mysql; -
配置密码
1
update user set password=password('123456') where user='root';
-
激活密码
1
flush privileges;
-
退出
1
quit;
-
无密码测试登录
Windows 连接 虚拟机的MYSQL
【开启远程连接】
-
查看是否可以进行连接
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18-- 显示当前可连接身份
select host,user from user;
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
| localhost | scott |
+-----------+---------------+
4 rows in set (0.01 sec)
-- 数据结果解释
| localhost | root |
root 用户使用 localhost 连接 -
修改为所有用户都可以连接
1
2-- 可以通过公网 ip 连接
update user set host='%' where user ='root'
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 coder-itl!
评论