MySQL
hostname localhost
mysql -u root -p
// yRqyGEKK is the DB name for WordPress
CREATE DATABASE yRqyGEKK;
// Create a specific user who can only aceess WordPress's DB
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON yRqyGEKK.* TO wordpressuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
-
使用随机字符串作为 MySQL 中服务于WordPress 的 DB name。
-
为该 DB 创建特定的用户,该用户只具有对该 DB 中所有 table 的增删查改权限(最小权限原则)。当然,在上面的例子中,我为该用户赋予了对该 DB 中所有 table 的所有权限
-
无法从外部连接MySQL,只能在本机(
localhost
)连接并访问
连接管理
允许MySQL被外部连接访问
//登录数据库
mysql -u root -p
use mysql;
select user,host from user;
update user set host='%' where user='root';
flush privileges;
// 或者
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
flush privileges;
sudo netstat -an | grep 3306
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper