centos之mysql安裝配置使用

來源:互聯網
上載者:User

標籤:oracl   pass   圖片   start   gpl   nbsp   ice   ant   tab   

安裝:  

yum install -y mysql-server

 

使用

  1. 重啟:  service mysqld restart

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

#進入控制台
[[email protected] yl]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.6.26 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.#顯出資料庫mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+4 rows in set (0.01 sec)mysql>

設定密碼(不需要重啟資料庫即可生效)。

mysql> set password for ‘root‘@‘localhost‘ =password(‘123456‘);Query OK, 0 rows affected (0.00 sec)mysql> 

  

配置

mysql設定檔為/etc/my.cnf

 

1、編碼

mysql設定檔為/etc/my.cnf

最後加上編碼配置

[mysql]default-character-set =utf8

這裡的字元編碼必須和/usr/share/mysql/charsets/Index.xml中一致。

2、遠端連線設定

把在所有資料庫的所有表的所有許可權賦值給位於所有IP地址的root使用者。

mysql> grant all privileges on *.* to [email protected]‘%‘identified by ‘123456‘;

如果是新使用者而不是root,則要先建立使用者

mysql>create user ‘username‘@‘%‘ identified by ‘password‘;  

此時就可以進行遠端連線了。

centos之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.