安装Mariadb、Postgresql、Redis
- 安装Mariadb: ``` sh sudo pacman -S mariadb sudo mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql
sudo systemctl start mariadb sudo systemctl enable mariadb
sudo mysql_secure_installation
sudo pacman -S mysql-workbench
- 安装Postgresql
``` sh
sudo pacman -S postgresql
sudo su postgres -l
initdb --locale $LANG -e UTF8 -D '/var/lib/postgres/data/'
exit
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo pacman -Sy pgadmin4
- 安装Redis
sudo pacman -S redis
管理用户
- Mysql ``` sql – 创建用户 CREATE USER ‘username’@’host’ IDENTIFIED BY ‘password’;
– 授予用户某表权限 GRANT SELECT,UPDATE ON . TO ‘username’@’host’ IDENTIFIED BY ‘password’;
– 删除用户 DROP USER ‘username’@’host’; DELETE FROM mysql.user where host=’host’ and user=’username’;
– 修改用户密码:
SET PASSWORD=PASSWORD(‘password’);
SET PASSWORD FOR ‘username’@’host’=PASSWORD(‘password’);
```
Mysql的用户是存储在mysql.user
表里的,可通过select * from mysql.user;
查看所有用户。