Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL complete installation configuration

Shulou Source: shulou.com Published: 2022-06-01 04:49:07 09月23日 Update

one。 Create users and paths

1. Create MySQL user groups and users

# groupadd mysql

# useradd-g mysql mysql

two。 Create a data storage path

# mkdir / data/dbfile

# chown-R mysql.mysql / data/dbfile

two。 Install mysql 5.x.x.tar.gz

1. Compile

Default character set

Extended character set

Install Innodb

Specify the data storage path

Specify the system profile path

# / configure-- prefix=/data/mysql5-- with-charset=utf8-- with-extra-charsets=all-- with-plugins=partition,heap,innobase,myisam-- enable-thread-safe-client-- without-docs-- with-pthread-- enable-static-- with-big-tables-- without-debug-- localstatedir=/data/dbfile-- sysconfdir=/etc-infodir=/data/mysql5

# make

# make install

two。 Copy my.cnf

# cp mysql-5.1.31/support-files/my-medium.cnf / etc/my.cnf

3. Initialize the database

# mysql5131/bin/mysql_install_db-user=mysql

4. Start the MySQL service

# mysql5/bin/mysqld_safe-- user=mysql &

5. Stop the MySQL service

# mysql5/bin/mysqladmin shutdown

6.MySQL tuning my.cnf

Include Innodb configuration

7. Delete old Innodb log files

# rm / data/dbfile/ibdata1 ib_logfile0 ib_logfile1

8. Restart MySQL

9. View Innodb running status

Mysql > show variables like'% innodb%'

+-+

| | Variable_name | Value |

+-+

| | have_innodb | YES |

+-+

three。 Create a database

Mysql > GREATE DATABASE aa

[view aa default character set]

Mysql > show table status from test like'% aa%'G

* * 1. Row *

Name: aa

Engine: InnoDB

Version: 10

Row_format: Fixed

Rows: 8

Avg_row_length: 7

Data_length: 56

Max_data_length: 1970324836974591

Index_length: 1024

Data_free: 0

Auto_increment: NULL

Create_time: 2009-04-13 10:28:14

Update_time: 2009-04-13 11:51:37

Check_time: NULL

Collation: gbk_chinese_ci

Checksum: NULL

Create_options:

Comment:

four。 Set the MySQL service to boot automatically

Manage mysql services via service mysql start | stop | restart

# cp support-files/mysql.server / etc/rc.d/init.d/mysqld setting enables mysql to run automatically every time it starts

# chkconfig-add mysqld

# chkconfig-- level 345 mysqld on

# service mysqld start / / start mysqld service

five。 Set up global login

Log in directly via # mysql

Export PATH=$PATH:/data/mysql5/bin

[@ more@]

Tags: Service data path character character set user configuration database file storage login run global copy log status user group system administration compilation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Linux Docker Xiaomi