mysql安裝包安裝配置教程 Mysql安裝包



文章插圖
mysql安裝包安裝配置教程 Mysql安裝包

文章插圖
部署mysql5.7.25
1、下載rpm安裝包 。2、上傳到服務器,解壓 。3、卸載之前的版本 。4、按照順序安裝:
rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-devel-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpmrpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
5、修改配置文件為無需密碼登陸
vi /etc/my.cnf
[mysqld]#下添加skip-grant-tables=1 #不用驗證,無需密碼登陸6、修改默認字符集為utf8
vi /etc/my.cnf
[mysqld]#下添加character-set-server=utf8collation-server=utf8_general_ci[mysql]#下添加default-character-set=utf87、啟動mysql
systemctl start mysqld;
8、查看啟動是否報錯
systemctl status mysqld
9、【知識點】登陸mysql,默認已創建如下四個庫 。同時my.cnf中配置的datadir指定目錄下存在如下四個庫的文件夾 。
10、修改密碼
mysql>use mysqlmysql>update user setmysql>authentication_string=password(‘123456’) ,mysql>password_expired=‘N’,password_last_changed=now()mysql>where user=‘root’;mysql>flush privileges;mysql> alter user [email protected] identified by ‘123456’;mysql>Flush privileges;mysql>exit;同時my.cnf 刪除參數skip-grant-tables=1,重啟mysql:systemctl restart mysqld。
11、測試是否可用
mysql -uroot -p -e “show databases;”;–安全起見-p不加密碼
12、配置可被其他主機訪問新增host為‘%’的用戶:
create user readonly@% identified by’readonly’;grant select on