Install MySQL Summary

Source: Internet
Author: User
Tags mysql login

Due to the different versions of MySQL, there will be different installation methods. Under the Linux system under the MySQL5.1.19 version for example, to install, beginners also look correct.

First, install the compilation software (simple Yum installation)
Gcc
Gcc-c++
Ncurses
Ncurses-devel
CMake

Second, modify hosts to resolve host names

echo "127.0.0.1 ' hostname '" >>/etc/hosts

Three, compile and install
# tar xvf mysql-5.5.19.tar.gz
# cd mysql-5.5.19
# cmake.-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/usr/local/mysql/data \
-dmysql_unix_addr=/usr/local/mysql/tmp/mysql.sock \
-DDEFAULT_ Charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dextra_charsets=gbk,gb2312,utf8,ascii \
-DENABLED_ Local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-DWITH_ blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwithout_partition_storage_engine=1 \
-dwith_fast_mutexes=1 \
-dwith_zlib=bundled \
-denabled_local_infile=1 \
-dwith_readline=1 \
- dwith_embedded_server=1 \
-dwith_debug=0
# make && make install

Iv. Generating configuration files
# CP/ROOT/MYSQL-5.5.19/SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
# VIM/ETC/MY.CNF
[Mysqld]
DataDir =/usr/local/mysql/data

V. Create a new user to run MySQL
# Groupadd MySQL
# Useradd-r-G mysql-s/sbin/nologin MySQL

Vi. initialization
#/home/mysql-5.5.19/scripts/mysql_install_db \
--basedir=/usr/local/mysql/\
--datadir=/usr/local/mysql/data--user=mysql

Vii. modifying MySQL directory permissions
# Chown-r Root.mysql/usr/local/mysql
# Chmod-r 777/usr/local/mysql/data

Eight, start MySQL
#/usr/local/mysql/bin/mysqld_safe--user=mysql &

IX. Export Startup program
# Cp/home/mysql-5.5.19/support-files/mysql.server/etc/init.d/mysqld
# Chymod +x/etc/init.d/mysqld
# chkconfig--add mysqld
# service Mysqld Start

X. Export the MySQL login program
# ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql


Ps:

Log in to MySQL:

/usr/bin/mysql-u root-p Password

Install MySQL Summary

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.