CentOS 6.2配置MySQL伺服器

來源:互聯網
上載者:User
文章目錄
  • 安裝MySQL
  • 安全設定MySQL
  • MySQL相關目錄和檔案
安裝MySQL

使用yum install命令安裝MySQL:

yum install mysql-server mysql

 

更簡單的方式,使用yum groupinstall命令:

yum groupinstall "MySQL Database server"

 

檢查mysqld服務是否正確安裝:

$ chkconfig --list mysqldmysqld             0:off    1:off    2:off    3:off    4:off    5:off    6:off

若有必要,還可以配置mysqld服務為開機自動啟動:

chkconfig mysqld on

 

手工啟動mysqld服務:

service mysqld start

 

安全設定MySQL

MySQL提供了一個mysql_secure_installation程式,以互動的方式協助我們調整安全方面的設定。

$ mysql_secure_installation
... ...In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): ##輸入MySQL的root密碼,初始為空白OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.Set root password? [Y/n] n ##是否需要重設root密碼? ... skipping.By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] ##是否需要刪除匿名帳號? ... Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] ##是否禁用root帳號在其它電腦登入? ... Success!By default, MySQL comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] ##是否需要刪除test資料庫? - Dropping test database... ... Success! - Removing privileges on test database... ... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] ##是否需要重新裝入授權資訊? ... Success!Cleaning up...All done! If you've completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL!

  

MySQL相關目錄和檔案

/etc/my.cnf:MySQL伺服器設定檔。

/var/lib/mysql:MySQL資料目錄,可以通過my.cnf修改。

/usr/bin/mysqlamdin:MySQL伺服器命令列程式。

/usr/bin/mysql: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.