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

Install mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz Universal Edition

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

Share

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

Installation documentation on the official website:

Https://dev.mysql.com/doc/refman/5.6/en/binary-installation.html

Basic environment:

CentOS Linux release 7.1.1503 (Core)

1. Add mysql users

[root@localhost local] # groupadd mysql

[root@localhost local] # useradd-r-g mysql-s / bin/false mysql

2. Decompress mysql and establish soft links

[root@localhost local] # cd / usr/local/

[root@localhost local] # tar-zxvf mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz-C / home/software/

In the default startup program of the software, the address in / usr/local/ is read, so no matter where it is installed, it is better to build a soft link in / usr/local.

[root@localhost local] # ln-s / home/software/mysql-5.6.37-linux-glibc2.12-x86_64 mysql

Third, add environmental variables

This is a temporary environment, which needs to be added if multiple windows are operated at the same time.

[root@localhost mysql] # export PATH=$PATH:/usr/local/mysql/bin

[root@localhost local] # cd mysql

[root@localhost mysql] # chown-R mysql:mysql.

It's all root here. Look at yourself.

Fourth, install mysql

[root@localhost mysql] # scripts/mysql_install_db-- user=mysql

Installing MySQL system tables...2017-09-21 09:30:16 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2017-09-21 09:30:16 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.

2017-09-21 09:30:16 0 [Note]. / bin/mysqld (mysqld 5.6.37) starting as process 3271.

2017-09-21 09:30:16 3271 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-09-21 09:30:16 3271 [Note] InnoDB: The InnoDB memory heap is disabled

2017-09-21 09:30:16 3271 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-09-21 09:30:16 3271 [Note] InnoDB: Memory barrier is not used

2017-09-21 09:30:16 3271 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-09-21 09:30:16 3271 [Note] InnoDB: Using Linux native AIO

2017-09-21 09:30:16 3271 [Note] InnoDB: Using CPU crc32 instructions

2017-09-21 09:30:16 3271 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2017-09-21 09:30:16 3271 [Note] InnoDB: Completed initialization of buffer pool

2017-09-21 09:30:17 3271 [Note] InnoDB: Highest supported file format is Barracuda.

2017-09-21 09:30:17 3271 [Note] InnoDB: 128rollback segment (s) are active.

2017-09-21 09:30:17 3271 [Note] InnoDB: Waiting for purge to start

2017-09-21 09:30:17 3271 [Note] InnoDB: 5.6.37 started; log sequence number 1625987

2017-09-21 09:30:17 3271 [Note] Binlog end

2017-09-21 09:30:17 3271 [Note] InnoDB: FTS optimize thread exiting.

2017-09-21 09:30:17 3271 [Note] InnoDB: Starting shutdown...

2017-09-21 09:30:18 3271 [Note] InnoDB: Shutdown completed; log sequence number 1625997

OK

Filling help tables...2017-09-21 09:30:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2017-09-21 09:30:19 0 [Note] Ignoring-- secure-file-priv value as server is running with-- bootstrap.

2017-09-21 09:30:19 0 [Note]. / bin/mysqld (mysqld 5.6.37) starting as process 3294.

2017-09-21 09:30:19 3294 [Note] InnoDB: Using atomics to ref count buffer pool pages

2017-09-21 09:30:19 3294 [Note] InnoDB: The InnoDB memory heap is disabled

2017-09-21 09:30:19 3294 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-09-21 09:30:19 3294 [Note] InnoDB: Memory barrier is not used

2017-09-21 09:30:19 3294 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-09-21 09:30:19 3294 [Note] InnoDB: Using Linux native AIO

2017-09-21 09:30:19 3294 [Note] InnoDB: Using CPU crc32 instructions

2017-09-21 09:30:19 3294 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2017-09-21 09:30:19 3294 [Note] InnoDB: Completed initialization of buffer pool

2017-09-21 09:30:19 3294 [Note] InnoDB: Highest supported file format is Barracuda.

2017-09-21 09:30:19 3294 [Note] InnoDB: 128rollback segment (s) are active.

2017-09-21 09:30:19 3294 [Note] InnoDB: Waiting for purge to start

2017-09-21 09:30:19 3294 [Note] InnoDB: 5.6.37 started; log sequence number 1625997

2017-09-21 09:30:19 3294 [Note] Binlog end

2017-09-21 09:30:19 3294 [Note] InnoDB: FTS optimize thread exiting.

2017-09-21 09:30:19 3294 [Note] InnoDB: Starting shutdown...

2017-09-21 09:30:21 3294 [Note] InnoDB: Shutdown completed; log sequence number 1626007

OK

To start mysqld at boot time you have to copy

Support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the following commands:

. / bin/mysqladmin-u root password' new-password'

. / bin/mysqladmin-u root-h qkettle password' new-password'

Alternatively you can run:

. / bin/mysql_secure_installation

Which will also give you the option of removing the test

Databases and anonymous user created by default. This is

Strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

Cd. ;. / bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

Cd mysql-test; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

Http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file. / my.cnf on the system.

Because this file might be in use, it was not replaced

But was used in bootstrap (unless you used-- defaults-file)

And when you later start the server.

The new default config file was created as. / my-new.cnf

Please compare it with your file and take the changes you need.

WARNING: Default config file / etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

-- defaults-file argument to mysqld_safe when starting the server

The user name qkettle has been changed here (negligible).

Note: to turn data into a mysql user

[root@qkettle mysql] # chown-R root.

[root@qkettle mysql] # chown-R mysql data

Copy the startup program:

[root@qkettle mysql] # cp support-files/mysql.server / etc/init.d/mysql.server

Here, if / usr/local does not have a mysql soft link, it will report an error and say that the service cannot be found.

6. Start the MySQL service and there is an error: (if there is no error, just check to see if there is a MySQL process, and just move on.)

[root@qkettle mysql] # / etc/init.d/mysql.server start

Starting MySQL.170921 10:03:14 mysqld_safe error: log-error set to'/ var/log/mariadb/mariadb.log', however file don't exists. Create writable for user 'mysql'.

ERROR! The server quit without updating PID file (/ var/lib/mysql/qkettle.pid).

Resolve:

[root@qkettle mysql] # vim / etc/my.cnf

[mysqld_safe]

Log-error=/var/log/mysql/mariadb.log

Pid-file=/var/run/mysql/mariadb.pid

Restart: successful

[root@qkettle mysql] # / etc/init.d/mysql.server start

Starting MySQL.Logging to'/ var/log/mysql/mariadb.log'.

. SUCCESS!

View the process

[root@qkettle mysql] # ps-ef | grep mysql

Root 4998 10 10:05 pts/1 00:00:00 / bin/sh / usr/local/mysql/bin/mysqld_safe-datadir=/var/lib/mysql-pid-file=/var/lib/mysql/qkettle.pid

Mysql 5159 4998 0 10:05 pts/1 00:00:00 / usr/local/mysql/bin/mysqld-basedir=/usr/local/mysql-datadir=/var/lib/mysql-plugin-dir=/usr/local/mysql/lib/plugin-user=mysql-log-error=/var/log/mysql/mariadb.log-pid-file=/var/lib/mysql/qkettle.pid-socket=/var/lib/mysql/mysql.sock

Seventh, establish a soft link and start mysql.

[root@qkettle mysql] # ln-s / usr/local/mysql/bin/mysql / usr/local/bin/mysql

There is an error here:

[root@qkettle bin] # mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ tmp/mysql.sock' (2)

Solution:

Stop the service first, and then modify a place.

[root@qkettle bin] # / etc/init.d/mysql.server stop

Shutting down MySQL.. SUCCESS!

[root@qkettle mysql] # vim / etc/my.cnf

Socket=/tmp/mysql.sock

Start the service again and log in

[root@qkettle bin] # / etc/init.d/mysql.server start

Initial login

Mysql-u root

Modify root user password

Mysql > use mysql

Mysql > update user set password=password ("123456") where user='root'

Mysql > flush privileges

Log out and log in with your password again

Mysql > exit

Check the character set of the database

Mysql > show variables like 'char%'

Modify the database character set, other formats are the same.

Mysql > set character_set_database=utf8

The character set does not work well after reboot.

Need to modify the configuration file / etc/my.cnf

Add a paragraph under [mysqld]. Don't make a mistake, or it won't start.

Character-set-server=utf8

Because I have only one mysqld paragraph here, I didn't add anything else.

If there are other paragraphs that need to be added to the character set, you also need to add them.

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