Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL compilation in Ubuntu

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to install MySQL compilation in Ubuntu, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

I. Ubuntu MySQL compile previous conditions

Make sure you have installed the following software. Some may not be necessary, but it is recommended that you install them all.

apt-get install autoconf automake autotools-dev cpp curl gawk gcc lftp libc6-dev linux-libc-dev make libpcre3-dev libpcrecpp0 g++ libtool libncurses5-dev aptitude install libmysql++-dev libmysqlclient15-dev checkinstall apt-get install python python-dev

Ubuntu MySQL installation required files

List of required documents

mmseg-0.7.3.tar.gz Chinese participle mysql-5.1.26-rc.tar.gz mysql-5.1.26 Source Code sphinx-0.9.8-rc2.tar.gz sphinx-0.9.8-rc2 Source Code fix-crash-in-excerpts.patch sphinx support word segmentation patch sphinx-0.98rc2.zhcn-support.patch sphinx support word segmentation patch

The files can be downloaded from the official website. I will provide the series files in the attachment.

Ubuntu MySQL starts installation

First transfer the above files to the root directory

1. mmseg-0.7.3 installation, extract the installation file

tar -zxvf mmseg-0.7.3.tar.gz cd mmseg-0.7.3/ ./ configure make make install cd ../

To this end mmseg installation can try to enter mmseg command, see if the installation has been successful

2, Install Ubuntu MySQL 5.1.26-rc, Sphinx, SphinxSE storage engine

Unzip MySQL and sphinx source files first

tar zxvf mysql-5.1.26-rc.tar.gz tar zxvf sphinx-0.9.8-rc2.tar.gz

Then patch sphinx. This is a must-have patch to support Chinese. cd sphinx-0.9.8-rc2/

(Please make sure patch is installed, if not use apt-get install patch)

patch -p1

< ../sphinx-0.98rc2.zhcn-support.patch patch -p1 < ../fix-crash-in-excerpts.patch 接着将sphinx下的mysqlse 文件夹下的数据拷贝到mysql-5.1.26-rc/storage/sphinx 下面(这样才能在编译mysql的时候把SphinxSE存储引擎编译进去) cp -rf mysqlse ../mysql-5.1.26-rc/storage/sphinx到/mysql-5.1.26-rc/storage/sphinx目录下确认文件是否已经拷贝成功cd ../下面我们来编译安装mysql-5.1.26-rc cd mysql-5.1.26-rc/sh BUILD/autorun.sh 这步是必须的,请勿遗漏. 使用configure命令确认安装./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all --with-plugins=sphinx确认是否提示可使用make编译,如果是。 执行 make这步执行时间比较长,一般在10-20分钟,主要看个人电脑配置编译成功后.再执行安装命令(如果出现error,需要重新编译,一般80%的error都是编译环境没有装好(个人编译体会))make install //这个过程大概需要1分钟不到的时间这样Ubuntu MySQL就已经安装完毕了. 下面我们来配置和启动Ubuntu MySQL添加Ubuntu MySQL用户组和用户 groupadd mysql useradd -g mysql mysql 给Ubuntu MySQL所在目录添加Ubuntu MySQL用户权限chown mysql:mysql /usr/local/mysql -R 将my-medium.cnf 拷贝到安装根目录cp /usr/local/mysql/share/mysql/my-medium.cnf /usr/local/mysql/my.cnf给my.cnf文件添加mysql用户权限chown mysql:mysql /usr/local/mysql/my.cnf 然后修改my.cnf配置在skip-external-locking上面插入(配置可以自定义) user = mysql pid-file = /usr/local/mysql/mysql.pid socket = /tmp/mysq.sock port = 3306 basedir = /usr/local/mysql datadir = /usr/local/mysql/data tmpdir = /tmp language = /usr/local/mysql/share/mysql/English 将里面的# -skin-dbd 注释掉,否则在执行启动MySQL命令 时会报错误为了能在ubuntu系统下方便的使用MySQL, 我们还需要安装 mysql-client-5.0 (客户端)apt-get install mysql-client-5.0初始化数据库/usr/local/mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf --user=mysql 执行结果Installing MySQL system tables...080917 14:36:16 [Warning] Storage engine 'SPHINX' has conflicting typecode. Assigning value 42.OKFilling help tables...080917 14:36:16 [Warning] Storage engine 'SPHINX' has conflicting typecode. Assigning value 42.OK……………….. 以上提示表示执行成功此时你会发现/user/local/mysql 目录下多了一个data文件夹,这文件夹里存放的是mysql数据内容我们需要给该目录赋予用户权限和写的权限 chown mysql:mysql -R /usr/local/mysql/data/ chmod -R o+w /usr/local/mysql/data/ 将mysql.server 拷贝成 /etc/init.d/mysqld 文件cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld并给mysqld添加执行权利chmod 700 /etc/init.d/mysqld通过执行/etc/init.d/mysqld start 启动mysql 也可以使用stop | restart 等一些命令然后我们输入mysql 命令,进去Mysql>

Type show engines; at this point we can see that we have included the sphinxSE engine to this myql section to start up and then we install sphinx-0.9.8-rc2

cd sphinx-0.9.8-rc2/ CPPFLAGS=-I/usr/include/python2.4 LDFLAGS=-lpython2.4 ./ configure --prefix=/usr/local/sphinx --with-mysql=/usr/local/mysql make make install cd ../

After installation, copy sphinx.conf.dist to sphinx.conf file cp /usr/local/sphinx/etc/sphinx.conf.dist /usr/local/sphinx/etc/sphinx.conf

Modify the configuration in sphinx.conf as follows: (Configuration can be customized)

sql_host = localhost sql_user = root sql_pass = sql_db = test sql_port = 3306

Load index/usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.conf --all Note: First establish soft link to libmysqlclient.so.16 ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16

Then turn on index listening through/usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/sphinx.conf For the convenience of the following test, we first pour the example.sql script that comes with sphinx.conf into mysql mysql

The above is "How to install MySQL compilation in Ubuntu" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report