Linux under Mysql 5.5.8 source code compilation installation record sharing _mysql

Source: Internet
Author: User
Tags readline

System: Ubuntu 10.10
MySQL source file: mysql-5.5.8.tar.gz
Tools required for installation: CMake, GNU make, GCC, Perl, Libncurses5-dev, bison (optional), chkconfig
Note:
1. The official source code for 2010-11-18 has several bugs that were manually modified by reference to official instructions before compiling.

Official Note Link: http://lists.mysql.com/commits/126782
2. Official 5.5 Version reference manual: http://dev.mysql.com/doc/
Khan for a moment, 3392 pages of reference manual!
=> Tool Installation:
1. CMake
----did not compile the installation itself CMake
----shell:~$ sudo apt-get install CMake
----Version: 2.8.2
2. GNU make
----Ubuntu Self-belt
----Version: 3.81
3.GCC
----Ubuntu Self-belt
----Version: 4.4.5 (Official document: Must be more than 3.2)
4.Perl
----Ubuntu Self-belt
----Version: 5.10.1
5.libncurses5-dev (Ncurses-devel)
----If this bag is bad, the error will be cmake.
The package name on the----Debian/ubuntu is libncurses5-dev,redhat and the other versions correspond to Ncurses-devel
----shell:~$ sudo apt-get install Libncurses5-dev
----error message
------------------www.linuxidc.com---------------
--MySQL 5.5.8
--Could not find Curses (missing:curses_library curses_include_path)
CMake Error at cmake/readline.cmake:82 (message):
Curses Library not found. Please install appropriate package,

Remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package the name is Libncurses5-dev,
On RedHat and derivates it is ncurses-devel.
Call Stack (most recent call i):
cmake/readline.cmake:126 (find_curses)
cmake/readline.cmake:216 (Mysql_use_bundled_libedit)
cmakelists.txt:256 (Mysql_check_readline)

--Configuring incomplete, Errors occurred!
---------------------------------
6. Bison
----shell:~$ sudo apt-get install bison
----optional. Without this tool, a warning is reported when make.
----WARNING Record:
---------------------------------

Warning:bison executables not found in PATH
---------------------------------
7.chkconfig
----After the MySQL service is configured to be required from startup.
----shell:~$ sudo apt-get install chkconfig
=>mysql Installation:
1. Extract source code files
----The shell to the directory where the source code files are located
----Decompression
shell:~$ Tar zxvf mysql-5.5.8.tar.gz
2.cmake operation
----The shell to the extracted source folder directory (folder: mysql-5.5.8)
----CMake Execution:
---------------------------------
shell:~$ Cmake-dcmake_install_prefix=/usr/local/mysql
-dmysql_datadir=/home/system_username/programming/mysql/mysqldata
-dsysconfdir=/etc
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1
-dwith_partition_storage_engine=1
-dmysql_unix_addr=/tmp/mysqld.sock
-dmysql_tcp_port=3306
-denabled_local_infile=1
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8-general_ci
-dmysql_user=mysql
Note: No line wrap. On the official document, the CMake command adds a dot behind it that doesn't know what it means. It's not going to execute here.
---------------------------------
Source Code configuration Options Description:
MySQL installed home directory, 5.5.8 version defaults to/usr/local/mysql, so you can not add
-dcmake_install_prefix=/usr/local/mysql

MySQL data saved path, custom
-dmysql_datadir=/home/system_username/mysql/mysqldata

MySQL configuration file address------The default my.cnf option file directory
-dsysconfdir=/etc

Compile storage engine XXX statically into server
/*storage engines are built as plugins. Can build a plugin as a static module (compiled into the server)
*or a dynamic module (built as a dynamic library that must is installed into the server using the INSTALL
*plugin statement or the--plugin-load option before it can be used). Some plugins might not support static
*or Dynamic Building.
*/
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1
-dwith_partition_storage_engine=1

Unix Socket File
/*
*the Unix socket file path on which the server listens for socket connections. This must is an absolute path
*name. The default Is/tmp/mysql.sock
*/
-dmysql_unix_addr=/tmp/mysqld.sock

The listener port for the database server TCP/IP connection, defaults to 3306
-dmysql_tcp_port=3306

Whether to enable the local capability into the client library for LOAD DATA INFILE
The default is off, this opens here
-denabled_local_infile=1

Database encoding Settings
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8-general_ci
3. Compile and install
----Shell to navigate to the Source code folder directory
----Execution: (the compilation took about 20 minutes)
shell:~$ make
shell:~$ make Install

4. Subsequent configuration
----access to the directory of MySQL installation directory
shell:~$ cd/usr/local/mysql/scripts
----Generate a new MySQL authorization form using mysql_install_db scripts
./mysql_install_db--basedir=/usr/local/mysql--datadir=/home/system_username/programming/mysql/mysqldata
--user=mysql
----access to the directory of supporting files under the MySQL installation directory
shell:~$ Cd/usr/local/mysql/support-files
----Copy MySQL configuration file
shell:~$ sudo cp my-medium.cnf/etc/my.cnf

----Copy Service files and modify
shell:~$ sudo cp mysql.server mysqld
----Modify Mysqld
Basedir=/usr/local/mysql
Datadir=/home/mysql
MV Mysqld/etc/init.d/mysqld
----Start a service
shell:~$ Service mysqld Start
----Shutdown Service
shell:~$ Service mysqld Stop
---------------------------------
Service command:
1. Commands for managing services in Linux Systems
2. The function is to go to the/ETC/INIT.D directory to find the appropriate services, open and close operation
3. After the above operation, the Mysqld service file corresponds to the Mysql.server file
---------------------------------
----Add a service to a self-starter item
shell:~$ sudo chkconfig--level 3 mysqld on

----Set up a soft connection to make MySQL, mysqldump, mysqladmin These three commands can be run directly in the shell
shell:~$ sudo ln-s/usr/local/mysql/bin/mysql/usr/bin
shell:~$ sudo ln-s/usr/local/mysql/bin/mysqldump/usr/bin
shell:~$ sudo ln-s/usr/local/mysql/bin/mysqladmin/usr/bin
---------------------------------
=>mysql Database Chinese garbled solution:
1. Garbled analysis
----from the terminal shell into MySQL
shell:~$ MySQL
............
............
Mysql> Show variables like '%character% '
----Get the following database encoding information table:
+----------------------------------- +-------------------------------------------+
| variable_name | Value |
+------------------------------------+-------------------------------------------+
| character_set_client | UTF8 |
| character_set_connection | UTF8 |
| Character_set_database | Latin1 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | Latin1 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/local/mysql/share/charsets/|
+------------------------------------ +-------------------------------------------+
You can see Character_set_database, character_set_server encoding or the default latin1.
Do not know why, before Default_charset set to become utf8, seems to have no effect. View official documents
Found that Character_set_database does not support configuration file (/ETC/MY.CNF) variable settings.
However, Character_set_server supports configuration file variable settings.

2. Solutions
----Open a configuration file
shell:~$ sudo gedit/etc/my.cnf
And then add it under the [mysqld] configuration option
Character-set-server = UTF8
----then go into MySQL
Perform:
Mysql> Show variables like '%character% '
Results: Character_set_database, character_set_server two items have become UTF8.
----Test:
Inserts a Chinese text segment into the database table, which is normally displayed in Mandarin.

Note: 1. When using the 5.1 version, the following methods can be used to solve the problem of Chinese coding
----are added separately in the configuration file [mysqld] and [client] sections: Default-character-set = UTF8
2. It is not known if the reason for manual compilation, in the 5.5.8 configuration file in the above method will cause the database service can not start.
----error log is as follows: (Datadir/username.err is an error log file)
----------------------------------------------------
Mysqld_safe mysqld from PID File/home/cyberwym/programming/mysql/mysqldata/cyberwym.pid ended
...........
...........
[ERROR]/usr/local/mysql/bin/mysqld:unknown variable ' Default-character-set=utf8 '
[ERROR] Aborting
----------------------------------------------------
----This will cause the PID file (datadir/username.pid) to be unable to update
----The database service is up and running after the configuration file [mysqld] and [client] sections are removed: Default-character-set = UTF8

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.