Source installation MySQL

Source: Internet
Author: User

To create a MySQL group:
Groupadd MySQL

Create a MySQL user and give this mysq group, do not create a home directory, do not allow users to log in. (Because the MySQL you just created is a virtual user, you are not allowed to log in)
Useradd mysql-g mysql-m-s/bin/nologin

Source installation MySQL
To compile and install after decompression:
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--WITH-SSL \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static

Make && make to install


After installing the soft link to create MySQL:
Ln-s/application/mysql5.1.72//application/apache

Under this directory view/usr/local/tools/mysql-5.1.72/support-files/the CNF profiles below, these files are the default profile templates, suitable for different scenarios
[email protected] support-files]# ll MY*.CNF
-rw-r--r--1 root root 4746 05-04 02:49 my-huge.cnf Fourth Small These are based on the server's hardware configuration to measure, the server hardware is too low, with the smallest, configured high, with the largest
-rw-r--r--1 root root 19779 05-04 02:49 my-innodb-heavy-4g.cnf the largest
-rw-r--r--1 root root 4720 05-04 02:49 my-large.cnf Third Small
-rw-r--r--1 root root 4731 05-04 02:49 my-medium.cnf the smallest
-rw-r--r--1 root root 2499 05-04 02:49 my-small.cnf Second Small
Then copy the configuration file that is appropriate for your server to/etc
[email protected] support-files]# CP my-small.cnf/etc/my.cnf

Create a directory where the MySQL database holds data:
[Email protected] ~]# mkdir/application/mysql/data-p

Grant MySQL user and MySQL group permissions to the/application/mysql/directory
[Email protected] ~]# chown-r mysql.mysql/application/mysql/

Initializing the data file
[Email protected] ~]#/application/mysql/bin/mysql_install_db--basedir=/application/mysql/--datadir=/application /mysql/data/--user=mysql

plication/mysql/data/--user=mysql
Installing MySQL system tables ...
170504 4:34:50 [Warning] '--skip-locking ' is deprecated and would be removed in a future release. Please use '--skip-external-locking ' instead.
OK
Filling Help Tables ...
170504 4:34:50 [Warning] '--skip-locking ' is deprecated and would be removed in a future release. Please use '--skip-external-locking ' instead.
OK

To start mysqld at boot time with to copy
Support-files/mysql.server to the right place for your system

REMEMBER to SET A PASSWORD for the MySQL root USER!
To does so, start the server, then issue the following commands:

/application/mysql//bin/mysqladmin-u root password ' new-password '
/application/mysql//bin/mysqladmin-u root-h node1.com password ' new-password '

Alternatively you can run:
/application/mysql//bin/mysql_secure_installation

Which would 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 Manual for more instructions.

You can start the MySQL daemon with:
cd/application/mysql/; /application/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
Cd/application/mysql//mysql-test; Perl mysql-test-run.pl

Problems with The/application/mysql//scripts/mysqlbug script!


Now that MySQL is installed, it will generate two libraries to view the data directory:
[Email protected] ~]# ll/application/mysql/data/
Total 8
drwx------2 MySQL root 4096 05-04 04:34 MySQL system library,
drwx------2 MySQL root 4096 05-04 04:34 test library, recommended removal, unsafe.

[Email protected] init.d]#/application/mysql//bin/mysqld_safe &
[1] 17071
[Email protected] init.d]# 170504 04:48:46 mysqld_safe Logging to '/application/mysql5.1.72/data/node1.com.err '.
170504 04:48:47 Mysqld_safe starting mysqld daemon with databases From/application/mysql5.1.72/data

[Email protected] init.d]#
[Email protected] init.d]#
[Email protected] init.d]#
[Email protected] init.d]#
[Email protected] init.d]#
[Email protected] init.d]# NETSTAT-TULNP | grep 3306
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 17179/mysqld




Start MySQL to start with start mode
[Email protected] init.d]# Cp/usr/local/tools/mysql-5.1.72/support-files/mysql.server/etc/init.d/mysqld
[Email protected] init.d]# chmod +x/etc/init.d/mysqld

You can start it after you save it.



mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Test |
+--------------------+
3 Rows in Set (0.00 sec)

mysql> drop database test;
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
+--------------------+
2 rows in Set (0.00 sec)

Mysql> select User,host from Mysql.user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| | localhost |
| Root | localhost |
| | node1.com |
| Root | node1.com |
+------+-----------+
5 rows in Set (0.00 sec)

mysql> drop User "" @localhost
;
Query OK, 0 rows Affected (0.00 sec)

mysql> drop User "" @node1. com
;
Query OK, 0 rows Affected (0.00 sec)

Mysql>
Mysql>
Mysql> select User,host from Mysql.user;
+------+-----------+
| user | Host |
+------+-----------+
| Root | 127.0.0.1 |
| Root | localhost |
| Root | node1.com |
+------+-----------+
3 Rows in Set (0.00 sec)

Source installation MySQL

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.