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

Analysis of solving the problem of compiling and installing MySQL5.6.26 in Ubuntu 15.04 Source Code

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

(1) install the packages needed to compile the source code

Sudoapt-get install make cmake gcc gathers + bison libncurses5-dev

The dependency package is available for download in the blog attachment. Some solutions are also described below.

In addition: cmake-2.8.3.tar.gz installation ah, bison_3.0.2.dfsg-2_i386.deb, ncurses-5.9.tar.gz dependence on the lack of then you can download and install, because of simplicity, the network others provide a lot of downloads, here will not be verbose. Provide: the installation method of ncurses-5.9.tar.gz:

Enter the unzipped directory

2. $cd ncurses-5.9

3. $. / configure-prefix=/tools-with-shared\

-without-debug-without-ada-enable-overwrite

4. $make

5. $make install

6. $cd..

7. $rm-rf ncurses-5.9

(2) download and decompress

Download address: http://pan.baidu.com/s/1kUMQo8v

Mysql-5.6.26.tar.gz

Tar-zxvf mysql-5.6.26.tar.gz

Cd mysql-5.6.26

(3) compile and install

Compile configuration:

Cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/mysql/data-DSYSCONFDIR=/etc-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DWITH_PERFSCHEMA_STORAGE_ENGINE=1-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1-DWITHOUT_FEDERATED_STORAGE_ENGINE=1-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_EXTRA_CHARSETS=all-DENABLED_LOCAL_INFILE=1-DWITH_READLINE=1-DMYSQL_UNIX_ADDR=/usr / local/mysql/mysql.sock-DMYSQL_TCP_PORT=3306-DMYSQL_USER=mysql-DCOMPILATION_COMMENT= "lq-edition"-DENABLE_DTRACE=1-DOPTIMIZER_TRACE=1-DWITH_DEBUG=1

Compile:

Make

Installation:

Sudo make install

Configure MySQL

(1) create new users and groups running Mysql

Sudo groupadd mysql

Sudo useradd-g mysql mysql

Ubuntu encountered a problem creating here. Home does not have this directory mysql. Failed to build. The solution is shown below:

Then go to the user's mysql directory to see if there are the following files:

(2) set the permissions of the Mysql installation directory

Cd / usr/local/mysql

Sudo chown-R mysql:mysql. /

(3) establish a configuration file

Cp support-files/my-default.cnf / etc/my.cnf

Sudo chown mysql:mysql / etc/my.cnf

Modify the configuration file:

Sudo vi / etc/my.cnf

[mysqld_multi] mysqld = / usr/local/mysql/bin/mysqld_safemysqladmin = / usr/local/mysql/bin/mysqladminuser = testpassword = test [mysqld3306] port = 3306socket = / tmp/mysql3306.sockpid-file = / tmp/mysql3306.pidbasedir = / usr/local/mysqldatadir = / usr/local/mysql/data#sql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_ tables [mysqld3307] port = 3307socket = / tmp/mysql3307.sockpid-file = / tmp/mysql3307.pidbasedir = / usr/local/mysqldatadir = / usr/local/mysql/data2#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_ tables [mysqld3308] port = 3308socket = / tmp/mysql3308.sockpid-file = / tmp/mysql3308.pidbasedir = / usr/local/mysqldatadir = / usr/local/mysql/data3#sql_mode=NO_ENGINE_SUBSTITUTION STRICT_TRANS_TABLES# The following options will be passed to all MySQL clients [client] # password= your_passwordport= 3306socket= / tmp/mysql.sock# Here follows entries for some specific programs# The MySQL server [mysqld] port= 3306socket= / tmp/mysql.sockskip-external-lockingkey_buffer_size = 16Kmax_allowed_packet = 1Mtable_open_cache = 4sort_buffer_size = 64Kread_buffer_size = 256Knet_buffer_length = 2Kthread_stack = 128Kbasedir = / usr/local/mysqldatadir = / usr/local/mysql / data#skip-networkingserver-id= 1log_bin=/tmp/1.000001# Uncomment the following if you want to log updates#log-bin=mysql- bin[ mysqldump] quickmax_allowed_packet = 16m [mysql] # no-auto-rehashauto-rehash# Remove the next comment character if you are not familiar with SQL#safe- updates [myisamchk] key_buffer_size = 8Msort_buffer_size = 8m [mysqlhotcopy] interactive-timeout

(4) initialize the database

Cd/usr/local/mysqlsudo scripts/mysql_install_db-user=mysql-basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/

(5) start the mysql service

Method 1:

Direct start

The front desk starts:. / opt/mysql/server-5.5/bin/mysqld_safe--user=mysql

Switch backend: Ctrl+Z restore backend: fg

Bin/mysqld_safe-- user=mysql & / / start in the background

Check that the MySQL service is started:

Ps-ef | grep mysql

Log in to:. / bin/mysql-user=mysql

Enter: selectversion (); View version

Exit exits.

/ opt/mysql/server-5.5/data directory:

Ibdata1 stores data files

Ib_logfile0 log file

Ib_logfile1 log file

And

Method 2:

Start through the service

Add services and copy the startup script to the / etc/init.d directory:

Cd/usr/local/mysql/

Cp support-files/mysql.server / etc/init.d/mysql

There are a lot of scripts in support-files/, including a support-files/mysql.server, which can be copied to / etc/init.d/ to do the boot script. My.cnf is the configuration file to be read when mysql starts

Set permissions for text:

Sudo chmod 755 / etc/init.d/mysql

Start:

Sudo / etc/init.d/mysql start

(shut down mysql service: sudo / etc/init.d/mysql stop)

Or

Sudo service mysql start

(turn off mysql service: sudo service mysql stop)

Check that the MySQL service is started:

Ps-ef | grep mysql

(6) configure environment variables

To call mysql directly, you need to add the bin directory of mysql to the PATH environment variable.

Edit the / etc/profile file:

Sudo vim / etc/profile

Add the following two lines at the end of the file:

PATH=$PATH:/usr/local/mysql/bin

Export PATH

Close the file and run the following command to make the configuration take effect immediately:

Source / etc/profile

(7) change the root password (because the default password is empty)

Mysql-h227.0.0.1-uroot-p

Change your password after login: mysql >

Updatemysql.user set password=password ("mysqldba") where user='root'

Then refresh

Flushprivileges

Then exit quits.

Mysql--protocol=TCP-uroot-p-P3306-hlocalhost

Finally, log in to test:

Selectnow (), user (), version ()

Show databases

In addition, the installation failure needs to rely on the package: manual installation of offline deb under Ubuntu completely solves libncurses5-dev

I searched the whole network but did not solve the apt-get install libncurses5-dev problem. Today, I must solve it with all my heart. It took half a day to solve it. You can also successfully install the MySql database.

You often need to install various software packages in linux systems, such as terminallibrary of the ncurses class when compiling vim source code. It is easy to use sudo apt-get install libncurses5-dev online. Save annoying software dependencies in automatic installation.

Operating system: ubuntu 15.04ukylin

To install the package: libncurses5-dev

Download address: https://pkgs.org/ provides downloads all deb has a release, you can search for the dwb package you need. Find the downloaded English words carefully. (enter libncurses5-dev and you can come out)

Libncurses5-dev_6.0+20160625-1_i386.deb

Download the package (in deb format) and see the software dependencies (important).

(2) download the package and use the dpkg command to install the package

Deb is the installation format of debian linus, which is very similar to red hat's rpm. The most basic installation command is: dpkg-I file.deb

(3) if something goes wrong, re-examine the software dependency information emphasized in (1). To do this, you also need to download the software packages libncurses5, libtinfo-dev, libtinfo5, ncurses-bin. Looking at the dependencies of these packages separately, it is found that three of these packages are dependent on libtinfo5, and these packages are no longer dependent on many other packages. At this point, the next step is to install the packages in a certain order (dependency).

(4) execute the following commands in turn:

Dpkg-I file.deb

The download address is https://pkgs.org/. This is downloaded from the official website. All deb are released.

Download it all and put it in a directory and execute dpkg-I * .deb multiple times.

1:libtinfo5_6.0+20160625-1_i386.deb

2:libncurses5_6.0+20160625-1_i386.deb

3:ncurses-bin_6.0+20160625-1_i386.deb

4:libtinfo-dev_6.0+20160625-1_i386.deb

After that, the installation of libncurses5-dev_6.0+20160625-1_i386.deb is performed and completed successfully.

Complete the installation.

Now you can install the MySql database.

Read the above about solving the problem of Ubuntu 15.04 source code compilation and installation MySQL5.6.26 analysis, I hope it can bring some help to everyone in practical application. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

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: 253

*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

Database

Wechat

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

12
Report