日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

centos7 mysql安装与用户设置

發(fā)布時間:2023/12/20 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7 mysql安装与用户设置 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1、環(huán)境:Centos 7.0 64位
2、mysql版本:5.7
3、安裝:https://dev.mysql.com/doc/refman/5.7/en/installing.html
3.1、創(chuàng)建mysql用戶和組:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
3.2、忘記 linux下mysql5.7 root用戶的密碼:
service mysqld stop
修改/etc/my.inf 末尾添加 skip-grant-tables
service mysqld start
use mysql
update user set authentication_string=password('Kd8k&dfdl023') where user='root';
flush privileges;

將/etc/my.inf中的skip-grant-tables 刪掉;
service mysqld restart
mysql -uroot -p
use mysql
set password=password('newpassword');
3.3、創(chuàng)建mysql用戶
https://dev.mysql.com/doc/refman/5.7/en/adding-users.html
mysql> CREATE USER 'finley'@'localhost' IDENTIFIED BY 'some_pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'trade'@'%' WITH GRANT OPTION;
3.5、查看mysql端口:
mysql> show variables like 'port';
3.4、打開防火墻配置文件:
關(guān)閉并禁止firewall開機啟動:
停止
systemctl stop firewalld.service
禁止開機啟動
systemctl disable firewalld.service
安裝iptables防火墻
yum install iptables-services
編輯防火墻配置文件打開指定的端口號使用udp協(xié)議打開52100端口:
vi /etc/sysconfig/iptables
保存退出
:wq
最后重啟防火墻使配置生效
systemctl restart iptables.service
設(shè)置防火墻開機啟動
systemctl enable iptables.service

3.5、查詢mysql配置文件
locate my.cnf
查看mysql默認讀取的配置列表:
mysql --help|grep 'my.cnf'
查看3306端口信息:
netstat -apn|grep 3306
修改mysql設(shè)置中的bind-address選項:
bind-address = 0.0.0.0
修改mysql設(shè)置中的port選項:
port=3308
----->使用阿里云服務(wù)器,需額外配置阿里云安全規(guī)則,設(shè)置入場端口!!!!!(巨坑。。)

4、創(chuàng)建數(shù)據(jù)庫和數(shù)據(jù)表們:見sql文件。
5、centos設(shè)置cmd為支持中文
echo $LANG
yum group list
yum install system-config-users
yum groupinstall chinese-support


5.1、linux設(shè)置mysql編碼為utf-8

6、linux 命令執(zhí)行.sql文件
登錄mysql
執(zhí)行 source sqlpath



轉(zhuǎn)載于:https://www.cnblogs.com/lindsay-chh/p/7089860.html

總結(jié)

以上是生活随笔為你收集整理的centos7 mysql安装与用户设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。