centos7 mysql安裝與用戶設置

一、環境:Centos 7.0 64位二、mysql版本:5.7三、安裝:https://dev.mysql.com/doc/refman/5.7/en/installing.html3.一、建立mysql用戶和組:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html3.二、忘記 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.三、建立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.五、查看mysql端口:     mysql> show variables like 'port';3.四、打開防火牆配置文件:     關閉並禁止firewall開機啓動:     中止     systemctl stop firewalld.service     禁止開機啓動     systemctl disable firewalld.service     安裝iptables防火牆     yum install iptables-services     編輯防火牆配置文件打開指定的端口號使用udp協議打開52100端口:     vi /etc/sysconfig/iptables     保存退出     :wq     最後重啓防火牆使配置生效     systemctl restart iptables.service     設置防火牆開機啓動     systemctl enable iptables.service3.五、查詢mysql配置文件     locate my.cnf     查看mysql默認讀取的配置列表:     mysql --help|grep 'my.cnf'     查看3306端口信息:     netstat -apn|grep 3306     修改mysql設置中的bind-address選項:     bind-address = 0.0.0.0     修改mysql設置中的port選項:     port=3308     ----->使用阿里雲服務器,需額外配置阿里雲安全規則,設置入場端口!!!!!(巨坑。。)四、建立數據庫和數據表們:見sql文件。五、centos設置cmd爲支持中文   echo $LANG   yum group list   yum install system-config-users   yum groupinstall chinese-support5.一、linux設置mysql編碼爲utf-8六、linux 命令執行.sql文件   登陸mysql   執行 source sqlpath
相關文章
相關標籤/搜索