首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫

CentOS 6.5 YUM 安裝 MySQL 5.1.71 快速指南

     編輯:MySQL 資料庫相關知識

安裝命令

yum install -y mysql-server mysql mysql-devel

服務管理

service mysqld start|stop|restart|status

首次啟動關鍵輸出解讀

Initializing MySQL database: Installing MySQL system tables... OK
Filling help tables... OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!

必做初始化清單

  1. 設置開機自啟: chkconfig mysqld on
  2. 修改 Root 密碼: mysqladmin -u root password 'StrongPass123!'
  3. 運行安全腳本: mysql_secure_installation(刪除匿名用戶、禁止遠程 root、刪除 test 庫、重載權限)
  4. 配置生產級 my.cnf: 參考 /usr/share/mysql/my-medium.cnf 或 my-large.cnf 複製至 /etc/my.cnf

驗證安裝

mysql -u root -p -e "SELECT VERSION(); SHOW DATABASES;"

注意事項

  • CentOS 6 EOL(2020年11月停止維護),生產環境建議遷移至 CentOS 7/8/Stream 或 Rocky/AlmaLinux
  • MySQL 5.1 早已 EOL(2013年12月),存在未修復安全漏洞,僅用於舊系統維護
  • 新部署請使用 MySQL 5.7+ / 8.0 或 MariaDB 10.3+
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved