MySQL安装

MySQL安装

每次服务器到期,搭建新漏洞环境都要用,每次的mysql权限管理都狠麻烦,在此,直接提前排除问题

系统:ubuntu18.04 x86 64bit

下载地址:https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.32-1ubuntu18.04_amd64.deb-bundle.tar

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.32-1ubuntu18.04_amd64.deb-bundle.tar
tar -xf mysql-server_5.7.32-1ubuntu18.04_amd64.deb-bundle.tar

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libaio1
sudo apt-get install libtinfo5


sudo dpkg -i mysql-common_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg-preconfigure mysql-community-server_5.7.32-1ubuntu18.04_amd64.deb #设置数据的root用户密码
sudo dpkg -i libmysqlclient20_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-client_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-common_5.7.32-1ubuntu18.04_amd64.deb

sudo apt-get -f install
sudo apt-get -f install libmecab2

sudo dpkg -i mysql-community-server_5.7.32-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-server_5.7.32-1ubuntu18.04_amd64.deb

mysql -u root -p

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
# bind-address	= 127.0.0.1

开启远程连接

mysql -uroot -p

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES; 
exit;

sudo systemctl restart mysql

8版本
先
更新用户表:
UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;

你可能感兴趣的:(杂七杂八,mysql,数据库,服务器)