arch linux mysql using
1. 安装
sudo pacman -S mysql
默认安装的是开源的maraidb ;无所谓,兼容MySQL,基本没啥区别;
2. 配置
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
3. 启动
sudo systemctl start mysqld
4. 设置密码
sudo mysqladmin -u root password '密码'
5. 以root身份进入
mysql -u root -p
6. 开启远程访问
CREATE DATABASE 数据库名;
use 数据库;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码';
或者
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON 数据库名.* TO 数据库名@localhost IDENTIFIED BY '密码';
SET PASSWORD FOR '数据库名'@'localhost' = OLD_PASSWORD('密码');
刷新数据
flush privileges;
7. 设置开机自启动
sudo systmctl enable mysqld