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
- 120630 22:50:11 mysqld_safe Logging to '/var/log/mysqld.log '.
- 120630 22:50:11 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
- 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
- 120630 23:07:15 [ERROR]/usr/local/mysql/bin/mysqld:can ' t create/write to file '/var/run/mysqld/mysqld.pid ' (errcode: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
- 120630 23:18:53 mysqld_safe Logging to '/var/log/mysqld.log '.
- 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
- /usr/local/mysql/bin/mysqladmin:connect to server at ' localhost ' failed
- Error: ' Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2) '
- 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
- 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
- /usr/local/mysql/bin/mysqladmin Ver 8.42 distrib 5.5.24, for Linux on i686
- Copyright (c), +, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of the Oracle Corporation and/or its
- Affiliates. Other names trademarks of their respective
- Owners.
- Server version 5.5.24
- Protocol version 10
- Connection Localhost via UNIX socket
- UNIX Socket/tmp/mysql.sock
- Uptime:37 min-Sec
- 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