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

How to install the binary package of MySQL-5.5

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly tells you briefly how the binary package of MySQL-5.5 is installed. You can check the relevant professional terms on the Internet or find some related books to supplement it. We will not dabble here, so let's go straight to the topic. I hope this article on how to install the binary package of MySQL-5.5 can bring you some practical help.

Environment:

[root@SQL-M ~] # cat / etc/redhat-release

CentOS release 6.8 (Final)

[root@SQL-M ~] # uname-r

2.6.32-642.el6.x86_64

Start the installation configuration:

[root@SQL-M ~] # cd / usr/local/src/

[root@SQL-M src] # wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz

[root@SQL-M src] # ll-h

Total 178M

-rw-r--r-- 1 root root 178m Apr 22 16:27 mysql-5.5.55-linux2.6-x86_64.tar.gz

[root@SQL-M src] # tar zxf mysql-5.5.55-linux2.6-x86_64.tar.gz-C / usr/local/ # decompress

[root@SQL-M src] # cd..

[root@SQL-M local] # mv mysql-5.5.55-linux2.6-x86_64/ mysql-5.5.55 # renamed

[root@SQL-M local] # ln-s mysql-5.5.55 mysql # do soft connection

[root@SQL-M local] # useradd mysql-s / sbin/nologin-M # establish system users

[root@SQL-M local] # mysql/scripts/mysql_install_db-- basedir=/usr/local/mysql/-- datadir=/usr/local/mysql/data/-- user=mysql # initialize the database

[root@SQL-M local] # chown-R mysql:mysql mysql-5.5.55 # authorizes directories

[root@SQL-M local] # vi / etc/my.cnf # create configuration file for testing

[client] port=3306socket= / usr/local/mysql/ mysql.sock [mysqld] user = mysqldatadir = / usr/local/mysql/data/character-set-server = utf8skip-character-set-client-handshakeinit-connect = 'SET NAMES utf8'open_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 = 2kthread_stack = 192Ktmp_table_size = 2Mmax_heap_table_size = 2Mlog-bin = / usr/local/mysql/data/mysql-binbinlog_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 = 1Mlower_case_table_names = 1skip-name-resolveslave-skip-errors = 1032 Id = 1innodb_additional_mem_pool_size = 4Minnodb_buffer_pool_size = 16Minnodb_file_io_threads = 4innodb_thread_concurrency = 8innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_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=/var/ Log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

[root@SQL-M local] # cp mysql/bin/* sbin/ # copy the execution command to sbin

[root@SQL-M local] # cp mysql/support-files/mysql.server / etc/init.d/mysqld # generate startup script

[root@SQL-M local] # / etc/init.d/mysqld start # start the service directly

Starting MySQL. SUCCESS!

[root@SQL-M ~] # netstat-lntup # View Service

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

Tcp 0 0 0.0.0.0 3306 0.0.0.015 * LISTEN 7853/mysqld

[root@SQL-M] # lsof-iRu 3306

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

Mysqld 7853 mysql 12u IPv4 24118 0t0 TCP *: mysql (LISTEN)

[root@SQL-M local] # mysqladmin-u root password # give root password, login without secret by default

Enter password:

[root@SQL-M local] # mysql-uroot-p # Interactive password login

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 3

Server version: 5.5.55-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.13 sec)

Mysql > drop database test; # delete the test library

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root |:: 1 |

| | localhost |

| | root | localhost |

| | sql-m |

| | root | sql-m |

+-+ +

6 rows in set (0.11 sec)

Mysql > drop user root@'::1'; # delete useless users

Query OK, 0 rows affected (0.14 sec)

Mysql > drop user'@ localhost

Query OK, 0 rows affected (0.00 sec)

Mysql > drop user'@ 'sql-m'

Query OK, 0 rows affected (0.00 sec)

Mysql > drop user root@'sql-m'

Query OK, 0 rows affected (0.03 sec)

Mysql > select user,host from mysql.user

+-+ +

| | user | host |

+-+ +

| | root | 127.0.0.1 | |

| | root | localhost |

+-+ +

2 rows in set (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > quit

[root@SQL-M local] # mysqladmin-uroot-p123 password # change password

New password:

Confirm new password:

Test forgetting the root password to retrieve:

[root@SQL-M ~] # / etc/init.d/mysqld stop # stop the service first

Shutting down MySQL.. SUCCESS!

[root@SQL-M ~] # mysqld_safe-- skip-grant-tables & # ignore authorization table to start the service

[1] 3685

170422 17:37:34 mysqld_safe Logging to'/ var/log/mysqld.log'.

170422 17:37:34 mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data

[root@SQL-M ~] # 170422 17:37:39 mysqld_safe mysqld from pid file / var/run/mysqld/mysqld.pid ended

[1] + Done mysqld_safe-- skip-grant-tables

It's strange that it failed! Take a look at the journal first.

[root@SQL-M ~] # tail / var/log/mysqld.log

170422 17:39:41 InnoDB: Waiting for the background threads to start

170422 17:39:42 InnoDB: 5.5.55 started; log sequence number 1595668

170422 17:39:42 [Note] Recovering after a crash using / usr/local/mysql/data/mysql-bin

170422 17:39:42 [Note] Starting crash recovery...

170422 17:39:42 [Note] Crash recovery finished.

170422 17:39:42 [Note] Server hostname (bind-address): '0.0.0.0; port: 3306

170422 17:39:42 [Note]-'0.0.0.0' resolves to' 0.0.0.0'

170422 17:39:42 [Note] Server socket created on IP: '0.0.0.09.

170422 17:39:42 [ERROR] / usr/local/sbin/mysqld: Can't create/write to file'/ var/run/mysqld/mysqld.pid' (Errcode: 2)

170422 17:39:42 [ERROR] Can't start server: can't create PID file: No such file or directory

As you can see, the pid file cannot be created, which must be due to lack of permissions.

The path / var/run/mysqld is configured in the configuration file:

[root@SQL-M] # tail-3 / etc/my.cnf

[mysqld_safe] log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

It's a little strange that starting the service with / etc/init.d/mysqld will not read the pid path configured in the configuration file, while starting the service with mysqld_safe-- skip-grant-tables & ignoring the authorization table will read the pid path in the configuration file.

Do not want to change the permissions of the / var/log/ directory, change the configuration file

[root@SQL-M ~] # vim / etc/my.cnf

[mysqld_safe] log-error=/var/log/mysqld.logpid-file=/usr/local/mysql/mysqld.pid

[root@SQL-M] # / usr/local/mysql/bin/mysqld_safe-- skip-grant-tables & # execute again

[1] 7109

170422 17:54:17 mysqld_safe Logging to'/ var/log/mysqld.log'.

170422 17:54:17 mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data

[root@SQL-M] # # this time is all right

[root@SQL-M ~] # mysql # password-free login

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 1

Server version: 5.5.55-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql >

Mysql > update mysql.user set password=password ('123') where user='root' and host='localhost'; # change password

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

Mysql > flush privileges; # log in with the new password after refreshing

Query OK, 0 rows affected (0.19 sec)

The above binaries are easily installed.

MySQL-5.5 binary package is how to install the first to tell you here, for other related issues you want to know can continue to follow our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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