Mysql configuration under Lampp xampp Linuxubuntu

Source: Internet
Author: User
Tags mysql client

Default execution Lampp/xampp after Ubuntu, a series of configurations for MySQL are required for better operation

MySQL configuration file path under LAMPP:

/opt/lampp/etc/my.cnf

1 Configuring the default character Set

Added under Mysqld

Character-set-server=utf8

Init_connect = ' SET NAMES UTF8 '

Add under Client

Default-character-set =utf8

Jiangzi OK, try to use the JetBrains Data Connection tool insert a Chinese data try it, see if you can insert Chinese UTF8 character data normally

2 Modifying the default allowed execution of the largest SQL script size

Why should I set this project?

If you have a SQL script that is larger than the default value, it will not be able to execute anymore.

The same my.cnf.

Items: Under Mysqld and Mysqldump

max_allowed_packet=500m

Settings can

3 Migrating the default database folder path

Just loaded LAMPP mysql its path is under/OPT, which is the system folder, we need to migrate it to the specified private database folder

Copy the default folder first

?
1 sudocp -rp /opt/var/mysql/home/xx

Then modify the settings in the MY.CNF

Client Item Sock Link file

Sock=/home/xx/mysql/mysql.sock

MYSQLD Item Sock Link file

Sock=/home/xx/mysql/mysql.sock

Add a Data folder variable to the next row in the Plugin_dir variable

Datadir=/home/xx/mysql

Complete database document path migration;

4 build linux MySQL client link command configuration

?
1 sudoapt-get install-y mysql-client-core-5.5

Install the sock link after the configuration.

Delete the original system mysql command path

?
1 sudorm-rf /var/run/mysqld

Rebuilding folders

?
1 sudomkdir/var/run/mysqld

Rebuilding a soft connection

?
1 sudoln-s /home/xx/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Then try the MySQL command directly under the command line.

5 Set InnoDB shared file index Table self-increment space

If not set, will also cause a variety of inexplicable ibdata1 start error

MY.CNF settings

Innodb_data_home_dir=/home/xx/mysql

innodb_data_file_path=ibdata1:5000m;ibdata2:5000m;ibdata3:1000m;ibdata4:1000m:autoextend:max:5000m

The actual development of this item does not need to be modified

This means that each time the self-increment table space 1000M, but the maximum value is 5000M, can be set according to their actual disk space, the lowest value is best not to use the default 10M or the actual production environment used easily fail

It's over here.

Welcome to reprint and attach original Thank you

6lampp start MySQL startup command

Start MySQL

Find the Startmysql () function

If TestRun "$XAMPP _root/var/mysql/$ (hostname). pid" Mysqld

To annotate it

Replaced by

If TestRun "/home/xx/mysql/$ (hostname). pid" Mysqld

Turn off MySQL

Find the Stopmysql () function

Comment if! Test-f "$XAMPP _root/var/mysql/$ (hostname). pid"

Replaced by

if! Test-f "/home/xx/mysql/$ (hostname). pid"

7 Modifying the startup script

?
1 sudogedit  /opt/lampp/bin/mysql.server

Find datadir=

Adding variable values

Datadir=/home/xx/mysql

Found it

Note lock_file_path= "$lockdir/mysql"

Replaced by

Lock_file_path= "/home/xx/mysql"

Ok

If startup fails, go to the Lampp/var/mysql folder to see the error log for the Err suffix name

Still have questions welcome thread

Mysql configuration under Lampp xampp Linuxubuntu

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.