相比Windows系统,Linux系统上安装MySQL比较简单,本文将详细介绍如何在Ubuntu系统安装MySQL。
PART 1 安装MySQL
1.更新软件源
sudo apt update
2.安装MySQL
sudo apt-get install mysql-server
sudo apt-get isntall mysql-client
sudo apt-get install libmysqlclient-dev
3.确认安装成功
# 输入以下命令能进入mysql则安装成功
mysql -u root -p
PART 2 MySQL常用命令
# 查看数据库
show databases;
# 添加用户
grant all privileges on testDB.* to test@localhost identified by ‘1234‘;
grant select,update on testDB.* to test@localhost identified by ‘1234‘;
grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";
grant all privileges on testDB.* to test@localhost identified by ‘1234‘;
flush privileges; //刷新系统权限表