The installation of MySQL

Source: Internet
Author: User

Remember to go to school, "research" once MySQL, find an article, read in class. has been more than 10 years, incredibly did not touch the database, self-thought to do the embedded database, looking back, but has been out for a long time ...

Surfing the internet to the newest mysql5.5, starting from scratch, the following are all simplified according to the official guidelines.

1. Preparation:

No cmake outfit CMake, no make, no Perl perl, no GCC ...!

2. Compiling:

CD $MYSQL _src_dir

CMake. (There's a little here)

Make install (multi-core Don't forget-j N, really soon)

Install to/usr/local/mysql by default

Cd/usr/local/mysql

3. Configuration:

I configure when the root user, development, no control so much.

scripts/mysql_install_db--user=mysql (root user must add user option)

The script will create the data directory in the current directory:

Chown-r MySQL Data (Modify the owner for MySQL)

4. Execution:

Bin/mysqld_safe--user=mysql &

The problem is as follows:

[Plain]View Plaincopy
    1. 120630 22:50:11 mysqld_safe Logging to '/var/log/mysqld.log '.
    2. 120630 22:50:11 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
    3. 120630 22:50:12 mysqld_safe mysqld from PID File/var/run/mysqld/mysqld.pid ended

Look at/var/log/mysqld.log.

[HTML]View Plaincopy
    1. 120630 23:07:15 [ERROR]/usr/local/mysql/bin/mysqld:can ' t create/write to file '/var/run/mysqld/mysqld.pid ' (errcode:2 )
    2. 120630 23:07:15 [ERROR] Can ' t start server:can ' t create PID file:no such file or directory

Without that directory, build one yourself, plus the permissions, re-execute, prompt:

[Plain]View Plaincopy
    1. 120630 23:18:53 mysqld_safe Logging to '/var/log/mysqld.log '.
    2. 120630 23:18:53 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql

It should be a success.

5. Test:

Bin/mysqladmin version, warning error:

[Plain]View Plaincopy
    1. /usr/local/mysql/bin/mysqladmin:connect to server at ' localhost ' failed
    2. Error: ' Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2) '
    3. Check that Mysqld was running and that the socket: '/tmp/mysql.sock ' exists!

Find Mysql.sock This goods did not find, look at/etc/my.cnf (this is mysqld himself created, do not want to use can go to Support-files to find another, anyway are not written by themselves, later study it again):

[Plain]View Plaincopy
    1. Socket=/var/lib/mysql/mysql.sock

Socket built in/VAR, then Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock, nothing to change

Then execute bin/mysqladmin version, prompting:

[Plain]View Plaincopy
  1. /usr/local/mysql/bin/mysqladmin Ver 8.42 distrib 5.5.24, for Linux on i686
  2. Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
  3. Oracle is a registered trademark of the Oracle Corporation and/or its
  4. Affiliates. Other names trademarks of their respective
  5. Owners.
  6. Server version 5.5.24
  7. Protocol version 10
  8. Connection Localhost via UNIX socket
  9. UNIX Socket/tmp/mysql.sock
  10. Uptime:37 min-Sec
  11. Threads:1 questions:20 Slow queries:0 opens:33 Flush tables:1 Open tables:26 queries per second avg:0.008

OK, the other tests are just a little bit of a document.

Development, so seriously why ...

The installation of MySQL

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.