Install database under Linux

Source: Internet
Author: User

第一步:下载64位二进制免编译包第二步:解压第三步:移动位置 /etc/local 并取名为mysql第四步:创建mysql用户第五步:创建文件夹 /data/第六步:初始化第七步:修改/etc/my.cnf 文件第八步:服务启动脚本mysql.servce/etc/init.d下并且改名为mysqld第九步:chkconfig --add mysqld 加入到系统服务列表中去第十步:启动

Uname-a viewing the number of system bits

i386--i686 are all 32-bit
X86_64 is 64-bit

wget no command found yum-y install wget #yum installation

Install the database (installs the same number of bits as the system) 64-bit binary package

  1. CD/USR/LOCAL/SRC #进入到这个路径下
    2.wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz #下载64位二进制免编译包
    3.
    3. Unpack the installation package tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz #源文件路径存放至/usr/local/src Path
    4.
    4. Move the unzipped installation package to/usr/local and create a folder renamed to MySQL
    5.
    5. Examples are as follows:
    6.
    6. See if it matches the picture.
    7.
    6. Enter/usr/local/mysql, create a user for MySQL
    7.
    7. Create a directory to function: to store MySQL data. The data directory is placed in this directory.

    8. Initialization, the so-called initialization is the directory that generates/DATA/MYSQLD.
    9.
    Note: The command will be executed with an error,-bash:./scripts/mysql_install_db:/usr/bin/perl: Bad interpreter: no file or directory
    Workaround:
    This command can see what plugins need to be installed,
    Install this plugin: yum-y install Perl-data-dumper

    However, after the installation is completed, the initialization will also be an error, so yum install libaio*-y is required

    Then, the initialization is done.

    The flag that determines the success of the initialization,
    The first type: 2 OK during initialization

    The second type: Echo $? , judge whether it is 0, note: After executing the previous command, immediately execute this, the role of this command is to verify that your previous command to perform the right! (Check the previous article only)

    Here, on behalf of initialization is complete.
    7. Copying a configuration file
    Profile path: MY-DEFAULT.CNF is the template configuration file for MySQL. Most of them are commented out.

    First: Copy the configuration file to/etc and change the name to MY.CNF Note: The MySQL configuration file is called MY.CNF, and is fixed on etc. If you place a different path, you need to specify it before starting. This is the first way to replicate a configuration file. (Not recommended)

    Second: Before copying, you can first look at etc under the directory, which comes with one of this file.

    RPM-QF/ETC/MY.CNF, this command allows you to view the installation of this file when it is installed by that rpm.

    When you do not copy the file, you need to change the configuration file inside the MY.CNF.

    8 startup script Mysql.server as startup script. :

    This script needs to be copied to/ETC/INIT.D and renamed to Mysqld
    CP Support-files/mysql.server/etc/init.d/mysqld

    Modify the Mysqld file

    Example below, just change here.

    If you want to set the boot to boot, you need to join the system Services list.
    Chkconfig--add mysqld Add to the list of system services
    Chkconfig--list View the System list service, MySQL in the diagram indicates that it has been added successfully.

    Start command:/etc/init.d/mysqld start
    /service mysqld Strart

    The rep has started successfully.
    Viewing the Listening port NETSTAT-LNTP


Other starting methods:/usr/local/mysql/bin/mysqld_safe--defaults-file=/etc/my.cnf--user=mysql--datadir=/data/mysql & (Press ENTER required)
To close a process:
Kailall MySQL stops the current write operation, writes all the data, and then closes it. (When this command kills the process, it slows down if the data that needs to be written is particularly large)

Service mysqld status Start state
Mysqld is stopped MySQL service is stopped state
MYSQLD is running MySQL service is boot state

Install database under Linux

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.