Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux system Mysql compilation installation configuration

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Installation of single instance Mysql database

1.1 set up a Mysql account

First log in to Linux as root, and then create a Mysql group and account

# groupadd mysql

# useradd-s / sbin/nologin-g mysql-M mysql

-g create a Mysql account that belongs to the mysql group

-s / sbin/nologin mysql account forbids login to the system

-M does not create a user's home directory

# tail-1 / etc/passwd (see create user)

Create a mysql software directory

# mkdir-p / home/app/tools (- p recursively creates a directory)

# cd / home/app/tools

1.2 compile and install mysql (version 5.1.62, the official downloaded version already supports 7.0system)

# cd / home/app/tools

# tar zxf mysql-5.1.62.tar.gz

# cd msyql-5.162

#. / configure-- prefix=/usr/local/mysql\ specifies the installation path of Mysql. Default is / usr/local.

-- with-unix-soket-path=/usr/local/mysql/tmp/mysql.sock\ specify the directory where Mysql socket files are stored

-- localstatedir=/usr/local/mysql/date\ sets the location of the data file for Mysql

-- enable-thread-safe-client\

-- with-mysqld-user=mysql\ specifies the system user under which Mysql is running

-- with-big-tables\

-- without-debug\

-- with-pthread\

-- enable-assembler\ allows assembly mode (optimizes performance)

-- with-extra-charsets=complex\

-- with-readline\

-- with-ssl\

-- with-embedded-server\

-- enable-local-infile\

-- with-plugin-PLUGIN\

-- with-mysqld-ldflags=-all-static\ Server uses static libraries (optimize performance)

-- with-client-ldfags=-all-static clients use static libraries (optimize performance)

# compilation parameters can be checked with. / configure-help command

# the above "\" represents a new line.

Statically compile to generate the execution file of mysqld

# make

# make install

1.3 Mysql profile

# cd / home/app/tools

# ls-l support-files/*.cnf

Support-files/my-huge.cnf

Support-files/my-innodb-heavy-4G.cnf

Support-files/my-large.cnf

Support-files/my-medium.cnf

Support-files/my-small.cnf

# sample configurations of mysql.cnf under # support-files

# use cp full path / bin/cp to copy without prompting for replacement. If a file with the same name is overwritten directly

# configuration template for my-small.cnf used in the test environment

1.4 create Mysql database files and initialize them

# mkdir-p / usr/local/mysql/data create Mysql database file directory

# chown-R mysql.mysql / usr/local/mysql authorizes Mysql users and groups to access the Mysql installation directory

# / usr/local/mysql/bin/mysql_install_db-- user=msqyl initializes the Mysql database

1.5 start the database and change the password

Method one

# / usr/local/mysql/bin/mysqld_safe-- user=mysql & "&" function, which executes mysql service at backend

# netstat-lnt | grep 3306 checks whether the service is enabled. If not, you can check the error r log.

# tail-100 / usr/local/mysql/data/ current machine name. Err

# ps-ef | grep mysql check process

Method two

Configure mysql commands to use paths globally

# echo 'export PATH=$PATH:/uer/local/mysql/bin' > > / etc/profile

# source / etc/profile

The above two commands realize the execution of mysql commands in any path.

Method three

Configure / etc/init.d/mysqld start mode to start the database

# cd / home/app/tools/mysql-5.1.62

# cp support-files/mysql.server / etc/init.d/mysqld copy the mysql startup script to the / etc/init.d directory

# chmod 700 / etc/init.d/mysqld authorizes 700 permissions, which can be executed by script

# / etc/init.d/mysqld start starts mysql

Set up the boot Mysql

# chkconfig-add mysqld

# chkconfig mysqld on

Change the Mysql default password

# mysqladmi-u root password '123456' change the default password, the initial password is empty

# mysql-uroot-p '123456' Log in to Mysql Database

Digression:

1. MySQL Community Server community version, open source and free, but does not provide official technical support.

2. MySQL Enterprise Edition Enterprise version, you need to pay for it. You can try it for 30 days.

3. MySQL Cluster cluster version, open source and free. Several MySQL Server can be encapsulated into a Server.

4. MySQL Cluster CGE Advanced Cluster Edition, you need to pay for it.

5. MySQL Workbench (GUI TOOL) is an ER/ database modeling tool specially designed for MySQL. It is the successor to the famous database design tool DBDesigner4. MySQL Workbench is divided into two versions, namely the community version (MySQL Workbench OSS) and the commercial version (MySQL Workbench SE).

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report