linux系統mysql安裝配置

來源:互聯網
上載者:User

linux系統mysql安裝配置
linux下使用yum安裝mysql一.mysql安裝查看有沒有安裝過mysql老版本:yum list installed mysql*rpm -qa | grep mysql*安裝mysqlyum install mysql-servermysql-devel mysql注意:這裡使用預設的yum 源只能安裝到mysql-5.1.73-3.el6_5.x86_64版本,想要安裝最新的mysql資料庫的話需要使用另外的安裝源
二.MySQL 5.5.x安裝
1、安裝MySQL 5.5.x的yum源:
rpm -Uvh http://repo.webtatic.com/yum/CentOS/5/latest.rpm
2、安裝MySQL用戶端的支援包:
yum install libmysqlclient15 --enablerepo=webtatic
3、卸載MySQL老版本的軟體包:
yum remove mysql mysql-*
4、安裝MySQL 5.5的用戶端和服務端:
yum install mysql55 mysql55-server --enablerepo=webtatic //--enablerepo=webtatic 指定使用第一步下載的yum源進行下載安裝
注意:這裡yum安裝的時候可能會報lib缺失,需要按照需要安裝必要的lib庫。

三.mysql啟動&&停止啟動mysql服務:service mysqld start或者/etc/init.d/mysqld start開機啟動:
chkconfig -add mysqld,查看開機啟動設定是否成功chkconfig --list | grep mysql*停止:service mysqld stop四.基本配置
1.修改root管理員密碼:mysqladmin -u root password "你想設定的密碼"
2.設定遠端存取mysql增加許可權:mysql庫中的user表新增一條記錄host為“%”,user為“root”。
grantallon*.*to‘root’@’%’;
flush privileges;3. MySQL的幾個重要目錄預設資料庫目錄,可以自行修改
/var/lib/mysql/
mysql記錄檔
/var/log/mysql.log(預設情況下)
設定檔/etc/my.cnf
附上我的my.cnf,供大家參考

 
  1. [client]
  2. socket=/var/lib/mysql/mysql.sock
  3. default-character-set=utf8
  4. [client]
  5. socket=/var/lib/mysql/mysql.sock
  6. default-character-set=utf8
  7. [mysqld]
  8. innodb_file_per_table=1
  9. default-character-set=utf8
  10. init_connect='SET NAMES utf8'
  11. datadir=/database/mysql
  12. socket=/var/lib/mysql/mysql.sock
  13. skip-external-locking
  14. user=mysql
  15. general_log_file=/database/mysql/log/mysql.log
  16. long_query_time=1
  17. slow_query_log=1
  18. slow_query_log_file=/database/mysql/log/slowquery.log
  19. key_buffer_size = 128M
  20. max_allowed_packet = 1M
  21. table_open_cache = 512
  22. sort_buffer_size = 4M
  23. read_buffer_size = 2M
  24. read_rnd_buffer_size = 8M
  25. myisam_sort_buffer_size = 64M
  26. thread_cache_size = 8
  27. query_cache_size = 32M
  28. query_prealloc_size = 64M
  29. join_buffer_size = 128M
  30. # Default to using old password format for compatibility with mysql 3.x
  31. # clients (those using the mysqlclient10 compatibility package).
  32. old_passwords=1
  33. # Disabling symbolic-links is recommended to prevent assorted security risks;
  34. # to do so, uncomment this line:
  35. # symbolic-links=0
  36. innodb_buffer_pool_size=64M
  37. [mysqld_safe]
  38. log-error=/database/mysql/log/mysql.error.log
  39. pid-file=/var/run/mysqld/mysqld.pid
  40. [myisamchk]
  41. key_buffer_size = 128M
  42. sort_buffer_size = 128M
  43. read_buffer = 2M
  44. write_buffer = 2M


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.