MySQL installation notes

zhaozj2021-02-16  59

MySQL installation notes

Cloud / 2003.10.10

Mail: Flashc@21cn.com

Welcome to reprint, please keep the above information, thank you

Learn for a long time Linux, it is necessary to make a note, the following is Mysql installation notes, and some common methods.

Because I like debug optimization system, I use some options in compilation and installation to increase the execution efficiency of programming procedures, some maybe I understand is wrong, I hope everyone should point out.

● Install MySQL

# TAR ZXVF mysql-4.0.14.tar.gz -c / setup

# Cd /setup/mysql-4.0.14

# GroupAdd MySQL

# UERADD MYSQL -G mysql -m -s / bin / false

# ./Configure --prefix = / web / mysql / specified installation directory

--without-debug / removal Debug mode

--with-extra-charsets = GB2312 / Add GB2312 Chinese character support

--Nable-assembler / assembly version of some character functions

--without-isam / Remove ISAM Table Type Support Now ISAM Table is a table with dependent platform

--without-innodeb / Removal InnoDB table Support InnoDB is a table that supports transaction processing, suitable for enterprise applications

--with-pthread / forced PTHREAD library (POSIX thread library)

--enable-thread-saffe-client / compiled client in thread

--with-client-ldflags = -all-static /

--with-mysqld-ldflags = -all-static / compiles the server and client --With-RAID / activation RAID support

# Make

# Make install

# Scripts / mysql_install_db / generate mysql user databases and table files

# CP support-files / my-medium.cnf /etc/my.cnf / copy profile, Large, Medium, SMALL three environments, depending on the machine performance selection, if the load is relatively large, some variables inside can be modified Memory usage value

# Cp support-files / mysql.server /etc/init.d/mysqld / copy launched mysqld file

# Chmod 700 /etc/ininit.d/mysqld

# CD / Web

# Chmod 750 mysql -r

# Chgrp mysql mySQL -R

# Chown mysql mysql / var -r

# CD / Web / MySQL / LIBEXEC

# Cp mysqld mysqld.old

# Strip mysqld

# Chkconfig --Add MySQLD

# Chkconfig --level 345 mysqld on

# Service mysqld start

# Netstat -atln

See if there is a port opening of 3306, if mysqld can't start, check out the error log under / web / mysql / var, generally the directory permissions are not set up.

# Ln -s / web / mysql / bin / mysql / sbin / mysql

# Ln -s / web / mysql / bin / mysqladmin / sbin / mysqladmin

# Mysqladmin -uroot password "Youpassword" # Set the password of the root account

# Mysql -uroot -p

# Enter your password you set

Mysql> USE Mysql;

Mysql> delete from user where password = ""; "Delete an empty password account for this anonymous connection

mysql> flush privileges;

Mysql> quit

● Install DBI and DBD for MySQL to provide Perl access to the interface specification of the mysql database, please confirm that you have installed Perl, the general default system is installed.

# Cd / setup

# TAR ZXVF DBD-mysql-2.9002.tar.gz -c / setup

# TAR ZXVF DBI-1.38.tar.gz -c / setup

# CD DBI-1.38

# Perl makefile.pl

# Make

# Make Test

# Make install

Because the path of Perl in the Perl program is / usr / local / bin / perl, and the Red Hat system is / usr / bin / perl by default, so it is best to make a connection to ensure compatibility

# Ln -s / usr / bin / perl / usr / local / bin / perl

# Cd ../dbd-mysql-2.9002

Generating installation profiles need to add some parameters after perl makefile.pl, trouble, we can add a problem to solve the problem by adding a connection to / web / mysql / bin / mysql_config

The system automatically looks for this command to generate the database parameters required for installation.

# Ln -s / web / mysql / bin / mysql_config / sbin / mysql_config

# Perl makefile.pl

# Make

# Make Instoll (here Make Test I always run half an error, but after installation, you can run the test script in the mysql directory, don't know how 3.x mysql)

Now you can run the test script, but the speed is very slow, hanging in the background.

# Perl / web / mysql / sql-bench / run-all-tests --user = root --password = "youpassword"

Attachment:

● Some useful options and commands for MySQL

MySQLD ----- Enable log support

--Log

--Log-Update

--Log-long-formart

● mysql

Grant All on Database. * to user identified by "password" New User user, gives all permissions to its Database database

Revoke All on Database from User Removes all permissions on the Database database

MySQL -UROOT -P --ONE-DATABASE DATABASENAME

● mysqladmin

MySQLADMIN FLUSH-LOGS command mysqld reopen a new log file, which is the empty old log file, which is equivalent to the reincarnation

● MySQLDUMP

- Add DROPTABLE IF EXISTS statement when exporting a SQL statement

- Quick Quick Export

--Opt optimization options (recommended)

● Myisamchk

Check the table option

--extend-check extension check

-Medium-Check speed compared one check option

Repair table option

--Recover repair table file

--safe-recover safety repair table file, more slower than - Recover

Modification repair entries

--force enforcement to clear the last temporary file

--quick is only repaired according to the content of the file

● MYSQL management

You can use phpMyadmin (environmental support you need PHP) and mysqlcc (Linux graphical interface support, Windows system support)

转载请注明原文地址:https://www.9cbs.com/read-20810.html

New Post(0)