centos7 mysql資料庫安裝和配置

來源:互聯網
上載者:User

標籤:roo   secure   防火牆   關閉   start   server   div   var   登入   

1、安裝yum源,已經下載安裝包
------------------------------------------------
rpm -ivh epel-release-latest-7.noarch.rpm
------------------------------------------------
2、安裝vim

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

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

# 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

6、安裝成功後重啟mysql服務

service mysqld restart

mysql_secure_installation(設定密碼)

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

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

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

查看安裝路徑 whereis mysql

mysql 登入mysql:mysql -u root -p
密碼:ShiQq!123456
mariadb 密碼:[email protected]
查看密碼 cat /var/log/mysqld.log | grep password
修改密碼 set password for ‘root‘@‘localhost‘ =password(‘password‘);
查看安裝路徑 whereis mysql
重啟mysql:service mysqld restart

自啟動mysql:systemctl enable mysqld

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

8、遠端連線設定
把在所有資料庫的所有表的所有許可權賦值給位於所有IP地址的root使用者。
mysql> grant all privileges on *.* to [email protected]‘%‘identified by ‘password‘;
如果是新使用者而不是root,則要先建立使用者
mysql>create user ‘username‘@‘%‘ identified by ‘password‘;
此時就可以進行遠端連線了。

用navicat,登入

centos7 mysql資料庫安裝和配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.