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

Mysql compilation, installation and other

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following content mainly brings you mysql compilation and installation and other, the knowledge mentioned here, slightly different from books, are summed up by professional and technical personnel in the process of contact with users, with a certain value of experience sharing, hoping to bring help to the majority of readers.

Compile and install MySQL

1. Install the dependent packages and compiling software required by MySQL

(1) install the dependency packages required by MySQL

# yum install ncurses-devel libaio-devel-y

(2) install the software needed to compile MySQL

# ls-lh cmake-2.8.8.tar.gz#tar xf cmake-2.8.8.tar.gz#cd cmake-2.8.8#./configure#gmake & & gmake install

Or install directly with yum

# yum install cmake-y

2. Start installing MySQL

(1) set up a MySQL user account

# useradd-s / sbin/nologin-M mysql

(2) obtain MySQL software package

Http://mirrors.sohu.com/

(3) install MySQL by compiling

# tar xf mysql-5.5.49.tar.gz#cd mysql-5.5.49cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.49\-DMYSQL_DATADIR=/application/mysql-5.5.49/data\-DMYSQL_UNIX_ADDR=/application/mysql-5.5.49/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_EMBEDDED_SERVER=1\-DWITH_DEBUG=0#make & & make install#ln-s / application/mysql-5.5.49/ / application/mysql

Database configuration file

# mkdir-p / data/3306/data#vim / data/3306/ my.cnf [client] port = 3306socket = / data/3306/ MySQL. Socks [MySQL] no-auto- rehash [mysqld] user = mysqlport = 3306socket = / data/3306/mysql.sockbasedir = / application/mysqldatadir = / data/3306/dataopen_files_limit = 1024back_log = 600max_connections = 800max_connect_errors = 3000table_cache = 614external-locking = FALSEmax_allowed_packet = 8Msort_buffer_size = 1Mjoin_buffer_size = 1Mthread_cache_size = 100thread_concurrency = 2query_cache_size = 2Mquery_cache_limit = 1Mquery_cache_min_res_unit = 2k#default_table_type = InnoDBthread_stack = 192K#transaction_isolation = READ-COMMITTEDtmp_table_size = 2Mmax_heap_table_size = 2Mlong_query_time = 1#log_long_format#log-error = / data/3306/error.log#log-slow-queries = / data/3306/slow.logpid-file = / data/3306 / mysql.pidlog-bin = / data/3306/mysql-binrelay-log = / data/3306/relay-binrelay-log-info-file = / data/3306/relay-log.infobinlog_cache_size = 1Mmax_binlog_cache_size = 1Mmax_binlog_size = 2Mexpire_logs_days = 7key_buffer_size = 16Mread_buffer_size = 1Mread_rnd_buffer_size = 1Mbulk_insert_buffer_size = 1M#myisam_sort_buffer_size = 1M#myisam_max_sort_file_size = 10G# Myisam_max_extra_sort_file_size = 10G#myisam_repair_threads = 1#myisam_recoverlower_case_table_names = 1skip-name-resolveslave-skip-errors = 1032 Magazine 1062replicatelichedqlservercolorid = 1innodb_additional_mem_pool_size = 4Minnodb_buffer_pool_size = 32Minnodb_data_file_path = 4innodb_thread_concurrency = 8innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodbaked log files _ Size = 4Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120innodb_file_per_table = 0 [mysqldump] quickmax_allowed_packet = 2m [mysqld _ safe] log-error=/data/3306/mysql_3306.errpid-file=/data/3306/mysqld.pid

Database startup file

# vim / Datagram 3306 raceme mysqlhammer raceme # # initport=3306mysql_user= "root" mysql_pwd= "123456" CmdPath= "/ application/mysql/bin" mysql_sock= "/ data/$ {port} / mysql.sock" # startup functionfunction_start_mysql () {if [!-e "$mysql_sock"] Then printf "StartingMySQL...\ n" / bin/sh$ {CmdPath} / mysqld_safe-- defaults-file=/data/$ {port} / my.cnf 2 > & 1 > / dev/null & else printf "MySQL isrunning...\ n" exit fi} # stop functionfunction_stop_mysql () {if [!-e "$mysql_sock"] Then printf "MySQL isstopped...\ n" exit else printf "StopingMySQL...\ n" ${CmdPath} / mysqladmin-u ${mysql_user}-p$ {mysql_pwd}-S / data/$ {port} / mysql.sock shutdown fi} # restart functionfunction_restart_mysql () {printf "RestartingMySQL...\ n" function_stop_mysql sleep 2 function_start_mysql} case $1 instart) function_start_mysql Stop) function_stop_mysql;;restart) function_restart_mysql;;*) printf "Usage:/data/$ {port} / mysql {start | stop | restart}\ n" esac

Modify file permissions # chown-R mysql.mysql / data#find / data-name mysql | xargs chmod 700

Configure the global path # echo 'export PATH=/application/mysql/bin:$PATH' > > / etc/profile#source / etc/profile initialize database # cd / application/mysql/scripts./mysql_install_db-- basedir=/application/mysql-- datadir=/data/3306/data-- user=mysql launch database / data/3306/mysql start login database # mysql-S / data/3306/mysql.sock modify database login password # mysqladmin-u root-S / data/3306 / mysql.sock password '123456'#mysql-uroot-p123456-S / data/3306/mysql.sock

Launch # find / data-type f-name "mysql" | xargs chmod 700#find / data-type f-name "mysql"-exec chown root.root {}\; set boot # echo "# mysql multi instances" > > / etc/rc.local#echo "/ data/3306/mysql start" > > / etc/rc.local

Delete unwanted databases > select user,host from mysql.user; > drop user 'root'@'::1'; > drop user' @ 'db01'; > drop user' root'@'db01'; > drop user'@ 'localhost'; > select user,host from mysql.user

> flush privileges

For the above mysql compilation and installation and other, if you need to know more, you can continue to pay attention to the innovation of our industry, if you need professional answers, you can contact the pre-sale and after-sale on the official website. I hope this article can bring you some knowledge updates.

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