Install and configure mysql in linux

Source: Internet
Author: User

Install and configure mysql in linux
Install mysql 1 using yum in linux. mysql Installation check whether the old mysql version has been installed: yum list installed mysql * rpm-qa | grep mysql * install mysqlyum install mysql-servermysql-devel mysql note: here the default yum source can only be installed in the mysql-5.1.73-3.el6_5.x86_64 version, to install the latest mysql database, you need to use another installation Source
Ii. Install MySQL 5.5.x
1. Install MySQL 5.5.x yum Source:
Rpm-Uvh http://repo.webtatic.com/yum/CentOS/5/latest.rpm
2. Install the MySQL client support package:
Yum install libmysqlclient15 -- enablerepo = webtatic
3. Uninstall the software packages of earlier MySQL versions:
Yum remove mysql -*
4. Install the MySQL 5.5 client and server:
Yum install mysql55 mysql55-server -- enablerepo = webtatic // -- enablerepo = webtatic specifies to use the yum source downloaded in step 1 to download and install
Note: During yum installation, the missing lib may be reported. Install the required lib library as required.

3. start mysql and stop mysql service: service mysqld start or/etc/init. d/mysqld start:
Chkconfig-add mysqld to check whether the startup setting is successful. chkconfig -- list | grep mysql * stop: service mysqld stop 4. basic configuration
1. Modify the root administrator password: mysqladmin-u root password "the password you want to set"
2. Set remote access to mysql to add permissions: the user table in the mysql database adds a record with host as "%" and user as "root ".
Grantallon *. * to 'root' @ '% ';
Flush privileges; 3. Several important MySQL directories default database directories, which can be modified by yourself
/Var/lib/mysql/
Mysql Log File
/Var/log/mysql. log (by default)
Configuration file/etc/my. cnf
Attach my. cnf for your reference

 
 
  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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.