Mysql compilation and Installation

Source: Internet
Author: User

Mysql compilation, installation, and installation preparations before www.2cto.com compilation and installation: Add a mysql account # useradd mysql objective: to avoid database initialization problems: [root @ www bin] # tar xvzf mysql-5.1.34.tar.gz-C/usr/local/src/[root @ www lamp] # cd/usr/local/src/[root @ www src] # cd mysql-5.1.34/[root @ www mysql-5.1.34] #. /configure -- with-mysqld-user = mysql -- prefix =/usr/local/mysql -- with-extra-charsets = all -- exec-prefix =/usr/local/mysql -- -innodb // which identity is used to run the installation directory when mysql is running The installation directory with all character sets will generate a bin table Type [root @ www mysql-5.1.34] # make & make install www.2cto.com initialization database: [root @ www mysql-5.1.34] # cd/usr/local/mysql/[root @ www mysql] # lsbin docs include lib libexec mysql-test share SQL-contents // The Directory should have default var directory for storing mysql Data, only after database initialization can [root @ www mysql] # cd bin [root @ www bin] #. /mysql_install_db: [root @ www mysql] # chown. mysql-R. // recursively modify the group of all files in the current directory (mysql installation directory) as the mysql group [Root @ www mysql] # ll-d. // view the details of the current directory.-d. List the directories like other files instead of drwxr-xr-x 11 root mysql 4096 12-25. [root @ www mysql] # chown mysql var-R // recursively modify the owner of the var directory to start the mysql account: [root @ www mysql] # cd bin/[root @ www bin] #. /mysqld_safe -- user = mysql & // start mysql in the background [root @ www bin] # ps-e 22127 pts/1 00:00:00 mysqld_safe22178 pts/1 00:00:00 mysqld A socket file [root @ www bin] # cd/tmp /[ Root @ www tmp] # ls mysql. sock mysql. sock In/tmp, if this file exists, it also indicates that mysql has been started. Without this file, mysql will not start -------------- modify the environment variable: Modify the environment variable of the home directory, you can run the command [root @ www ~] In the mysql bin directory in any directory. # Vim. bash_profile PATH =/usr/local/mysql/bin: $ PATH: $ HOME/bin to make it take effect: [root @ www ~] # Source. bash_profile test: [root @ www ~] # Which mysqladmin/usr/local/mysql/bin/mysqladmin [root @ www ~] # Pkill mysql // kill a mysql-enabled process another method to start mysql: copy the mysql STARTUP script to init. d [root @ www mysql] # pwd/usr/local/mysql/share/mysql [root @ www mysql] # cp mysql. server/etc/rc. d/init. d // you can change the name to mysqld [root @ www mysql] # service mysql. server restart ------------------ troubleshooting: if the database initialization fails, it may be due to the following reasons: [root @ www mysql] # grep mysql/etc/passwd first requires the mysql user mysql: x: 27: 27: MySQL Server:/var/lib/mysql:/bin/bash [root @ www mysql] #/etc/init. d/mysqld stop originally installed a mysql rpm package and started. stop MySQL first: [OK] [root @ www mysql] # rpm-q mysql uninstall the original installed rpm package mysql-5.0.45-7.el5 [root @ www mysql] # rpm-e mysql -- nodeps [root @ www bin] #. /mysql_install_db [root @ www bin] # cd .. [root @ www mysql] # lsbin docs include lib libexec mysql-test share SQL-callback var. At this time, a var is generated.

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.