centos7 mysql數據庫安裝和配置

一、安裝yum源,已經下載安裝包
------------------------------------------------
rpm -ivh epel-release-latest-7.noarch.rpm
------------------------------------------------
二、安裝vimhtml

yum -y install vim
------------------------------------------------
yum -y install wget
------------------------------------------------
yum -y install ruby
------------------------------------------------
三、Linux下添加磁盤、掛載,見掛載詳情
------------------------------------------------
注意:關閉防火牆 systemctl stop firewalld.service
------------------------------------------------
四、mysql安裝mysql

五、官網下載安裝mysql-server
5.1 官網下載rpm包 https://dev.mysql.com/downloads/repo/yum/
安裝wget
yum -y install wgetsql

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server數據庫

六、安裝成功後重啓mysql服務vim

service mysqld restartruby

mysql_secure_installation(設置密碼)ide

初次安裝mysql,root帳戶沒有密碼編碼

查看密碼 cat /var/log/mysqld.log | grep password
grep 'temporary password' /var/log/mysqld.logrest

首次登陸,修改密碼:修改密碼 set password for 'root'@'localhost' =password('your password');server

查看安裝路徑 whereis mysql

mysql 登陸mysql:mysql -u root -p
密碼:ShiQq!123456
mariadb 密碼:Seari@123456
查看密碼 cat /var/log/mysqld.log | grep password
修改密碼 set password for 'root'@'localhost' =password('password');
查看安裝路徑 whereis mysql
重啓mysql:service mysqld restart

自啓動mysql:systemctl enable mysqld

七、配置mysql,這裏的字符編碼必須和/usr/share/mysql/charsets/Index.xml中一致
詳見:http://www.cnblogs.com/starof/p/4680083.html

八、遠程鏈接設置
把在全部數據庫的全部表的全部權限賦值給位於全部IP地址的root用戶。
mysql> grant all privileges on *.* to root@'%'identified by 'password';
若是是新用戶而不是root,則要先新建用戶
mysql>create user 'username'@'%' identified by 'password';
此時就能夠進行遠程鏈接了。

用navicat,登陸

相關文章
相關標籤/搜索