cd /root/lnmp/src
wget -c http://ftp.osuosl.org/pub/mariadb/mariadb-5.5.32/kvm-tarbake-jaunty-x86/mariadb-5.5.32.tar.gz
useradd -M -s /sbin/nologin mysql
mkdir -p /data/mariadb;
chown mysql.mysql -R /data/mariadb
make && make install
cd .. tar zxf mariadb-5.5.32.tar.gz
cd mariadb-5.5.32
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_DATADIR=/data/mariadb \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_BIG_TABLES=1 \
-DWITH_DEBUG=0
make && make install
/bin/cp support-files/my-small.cnf /etc/my.conf
/bin/cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
cd .. # my.cf
cat > /etc/my.cnf << EOF
[mysqld]
basedir = /usr/local/mariadb
datadir = /data/mariadb
pid-file = /data/mariadb/mariadb.pid
character-set-server = utf8
collation-server = utf8_general_ci
user = mysql
port = 3306
default_storage_engine = InnoDB
innodb_file_per_table = 1
server_id = 1
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 7
bind-address = 0.0.0.0
# name-resolve
skip-name-resolve
skip-host-cache
#lower_case_table_names = 1
ft_min_word_len = 1
query_cache_size = 64M
query_cache_type = 1
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# LOG
log_error = /data/mariadb/mariadb-error.log
long_query_time = 1
#slow_query_log
slow_query_log_file = /data/mariadb/mariadb-slow.log
# Oher
#max_connections = 1000
open_files_limit = 65535
[client]
port = 3306
EOF
/usr/local/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/data/mariadb
chown mysql.mysql -R /data/mariadb
/sbin/service mysqld start
export PATH=$PATH:/usr/local/mariadb/bin
echo 'export PATH=$PATH:/usr/local/mariadb/bin' >> /etc/profile
source /etc/profile
/usr/local/mariadb/bin/mysql -e "grant all privileges on *.* to root@'127.0.0.1' identified by "dbrootpwd" with grant option;"
/usr/local/mariadb/bin/mysql -e "grant all privileges on *.* to root@'localhost' identified by "dbrootpwd" with grant option;"
/usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "delete from mysql.user where Password='';"
/usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "delete from mysql.db where User='';"
/usr/local/mariadb/bin/mysql -uroot -pdbrootpwd -e "drop database test;"
/sbin/service mysqld restart
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/local/mariadb/bin/mysqladmin' -u root password 'new-password'
'/usr/local/mariadb/bin/mysqladmin' -u root -h lambda-laptop password 'new-password'
Alternatively you can run:
'/usr/local/mariadb/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr/local/mariadb' ;
/usr/local/mariadb/bin/mysqld_safe --datadir='/data/mariadb'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mariadb/mysql-test' ;
perl mysql-test-run.pl