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

Installation practice of MySQL5.6 in Linux Environment

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

Share

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

The installation of MySQL is very simple compared to Oracle. Personally, I think it is closer to the installation and configuration of TimesTen, and the later configuration of Master-Slave or Master-Master cluster is simpler, even easier than TimesTen's ASP/Active-Active/Active-Standby configuration than TimesTen. However, there are still many initialization parameters involved in MySQL, and it will be difficult to start MySQL if the initialization parameters are not configured properly. This installation of MySQL feels more troublesome than installing Oracle RAC for the first time ten years ago. Baidu feels that all the steps on the Internet are clearly installed using the cmake package, so recording the installation steps here may be helpful for brothers who first come into contact with MySQL.

Installation steps:

1. Install the MySQL database software rpm package

2. Configure MySQL database parameter file my.cnf

3. Initialize the MySQL database instance

4. Start the MySQL service process mysqld

5. Change login password and check database parameters

I. operating system environment

IP:192.168.100.71 tony7

Operating system version:

# uname-a

Linux tony7 2.6.32-71.el6.x86_64 # 1 SMP Wed Sep 1 01:33:01 EDT 2010 x86 "64 GNU/Linux

# free-g

Total used free shared buffers cached

Mem: 1 0 1 0 0 0

-/ + buffers/cache: 0 1

Swap: 3 0 3

Df-h

# rpm-qa | grep-I mysql

Mysql-5.1.47-4.el6.x86_64

Perl-DBD-MySQL-4.013-3.el6.x86_64

Mysql-libs-5.1.47-4.el6.x86_64

Qt-mysql-4.6.2-16.el6.x86_64

Mysql-server-5.1.47-4.el6.x86_64

[root@tony7 soft] # rpm-e-- nodeps mysql-5.1.47-4.el6.x86_64

[root@tony7 soft] # rpm-e-- nodeps perl-DBD-MySQL-4.013-3.el6.x86_64

[root@tony7 soft] # rpm-e-- nodeps mysql-libs-5.1.47-4.el6.x86_64

[root@tony7 soft] # rpm-e-- nodeps qt-mysql-4.6.2-16.el6.x86_64

[root@tony7 soft] # rpm-e-- nodeps mysql-server-5.1.47-4.el6.x86_64

If installed, you need to delete the installed database, using the following command to delete the database

Delete command: rpm-e-- nodeps package name

(rpm-ev mysql-4.1.12-3.RHEL4.1)

Delete the development header files and libraries of the old version of mysql

Command: rm-fr / usr/lib/mysql

Rm-fr / usr/include/mysql

Note: the data and / etc/my.cnf in / var/lib/mysql will not be deleted after uninstallation. If determined to be useless, delete them manually.

Rm-f / etc/my.cnf

Rm-fr / var/lib/mysql

Second, install the database software

MySQL-server-5.6.28-1.el6.x86_64.rpm

MySQL-client-5.6.28-1.el6.x86_64.rpm

MySQL-devel-5.6.28-1.el6.x86_64.rpm

# rpm-ivh MySQL-server-5.6.28-1.el6.x86_64.rpm

Warning: MySQL-server-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # [100%]

1:MySQL-server # # [100%]

2016-01-18 14:42:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2016-01-18 14:42:21 0 [Note] / usr/sbin/mysqld (mysqld 5.6.28) starting as process 1671.

2016-01-18 14:42:21 1671 [Note] InnoDB: Using atomics to ref count buffer pool pages

2016-01-18 14:42:21 1671 [Note] InnoDB: The InnoDB memory heap is disabled

2016-01-18 14:42:21 1671 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2016-01-18 14:42:21 1671 [Note] InnoDB: Memory barrier is not used

2016-01-18 14:42:21 1671 [Note] InnoDB: Compressed tables use zlib 1.2.3

2016-01-18 14:42:21 1671 [Note] InnoDB: Using Linux native AIO

2016-01-18 14:42:21 1671 [Note] InnoDB: Using CPU crc32 instructions

2016-01-18 14:42:21 1671 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2016-01-18 14:42:21 1671 [Note] InnoDB: Completed initialization of buffer pool

2016-01-18 14:42:21 1671 [Note] InnoDB: The first specified data file. / ibdata1 did not exist: a new database to be created!

2016-01-18 14:42:21 1671 [Note] InnoDB: Setting file. / ibdata1 size to 12 MB

2016-01-18 14:42:21 1671 [Note] InnoDB: Database physically writes the file full: wait...

2016-01-18 14:42:21 1671 [Note] InnoDB: Setting logfile. / ib_logfile101 size to 48 MB

2016-01-18 14:42:22 1671 [Note] InnoDB: Setting logfile. / ib_logfile1 size to 48 MB

2016-01-18 14:42:22 1671 [Note] InnoDB: Renaming logfile. / ib_logfile101 to. / ib_logfile0

2016-01-18 14:42:22 1671 [Warning] InnoDB: New log files created, LSN=45781

2016-01-18 14:42:22 1671 [Note] InnoDB: Doublewrite buffer not found: creating new

2016-01-18 14:42:22 1671 [Note] InnoDB: Doublewrite buffer created

2016-01-18 14:42:22 1671 [Note] InnoDB: 128rollback segment (s) are active.

2016-01-18 14:42:22 1671 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-01-18 14:42:22 1671 [Note] InnoDB: Foreign key constraint system tables created

2016-01-18 14:42:22 1671 [Note] InnoDB: Creating tablespace and datafile system tables.

2016-01-18 14:42:22 1671 [Note] InnoDB: Tablespace and datafile system tables created.

2016-01-18 14:42:22 1671 [Note] InnoDB: Waiting for purge to start

2016-01-18 14:42:22 1671 [Note] InnoDB: 5.6.28 started; log sequence number 0

A random root password has been set. You will find it in'/ root/.mysql_secret'.

2016-01-18 14:42:22 1671 [Note] Binlog end

2016-01-18 14:42:22 1671 [Note] InnoDB: FTS optimize thread exiting.

2016-01-18 14:42:22 1671 [Note] InnoDB: Starting shutdown...

2016-01-18 14:42:24 1671 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2016-01-18 14:42:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2016-01-18 14:42:24 0 [Note] / usr/sbin/mysqld (mysqld 5.6.28) starting as process 1693.

2016-01-18 14:42:24 1693 [Note] InnoDB: Using atomics to ref count buffer pool pages

2016-01-18 14:42:24 1693 [Note] InnoDB: The InnoDB memory heap is disabled

2016-01-18 14:42:24 1693 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2016-01-18 14:42:24 1693 [Note] InnoDB: Memory barrier is not used

2016-01-18 14:42:24 1693 [Note] InnoDB: Compressed tables use zlib 1.2.3

2016-01-18 14:42:24 1693 [Note] InnoDB: Using Linux native AIO

2016-01-18 14:42:24 1693 [Note] InnoDB: Using CPU crc32 instructions

2016-01-18 14:42:24 1693 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2016-01-18 14:42:24 1693 [Note] InnoDB: Completed initialization of buffer pool

2016-01-18 14:42:24 1693 [Note] InnoDB: Highest supported file format is Barracuda.

2016-01-18 14:42:24 1693 [Note] InnoDB: 128rollback segment (s) are active.

2016-01-18 14:42:24 1693 [Note] InnoDB: Waiting for purge to start

2016-01-18 14:42:24 1693 [Note] InnoDB: 5.6.28 started; log sequence number 1625977

2016-01-18 14:42:24 1693 [Note] Binlog end

2016-01-18 14:42:24 1693 [Note] InnoDB: FTS optimize thread exiting.

2016-01-18 14:42:24 1693 [Note] InnoDB: Starting shutdown...

2016-01-18 14:42:26 1693 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER!

You will find that password in'/ root/.mysql_secret'.

You must change that password on your first connect

No other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/ usr/bin/mysql_secure_installation

Which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

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

New default config file was created as / usr/my.cnf and

Will be used by default by the server when you start it.

You may edit this file to change server settings

# rpm-ivh MySQL-devel-5.6.28-1.el6.x86_64.rpm

Warning: MySQL-devel-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # [100%]

1:MySQL-devel # # [100%]

[root@tony7 soft] # rpm-ivh MySQL-client-5.6.28-1.el6.x86_64.rpm

Warning: MySQL-client-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... # [100%]

1:MySQL-client # # [100%]

Create related folders and authorize mysql users

# mkdir-p / mysql/data/mysqldata/mydata

# mkdir-p / mysql/data/mysqldata/innodb_log

# mkdir-p / mysql/data/mysqldata/innodb_ts

# mkdir-p / mysql/data/mysqldata/log

# mkdir-p / mysql/data/mysqldata/sock

# mkdir-p / mysql/data/mysqldata/tmpdir

# id mysql

Uid=27 (mysql) gid=27 (mysql) groups=27 (mysql)

# chown-R mysql:mysql / mysql/data

Turn the mysql on and off.

# chkconfig-- level 2345 mysql off

# chkconfig-list mysql

Mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off

3. Configure the MySQL database parameter file my.cnf

Edit the my.cnf file

# vi / usr/my.cnf

# For advice on how to change settings please see

# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

Innodb_buffer_pool_size = 512m

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

# These are commonly set, remove the # and set as required.

Basedir = / usr

Datadir = / mysql/data/mysqldata/mydata

Port = 3306

Socket = / mysql/data/mysqldata/sock/mysql.sock

Tmpdir=/mysql/data/mysqldata/tmpdir

# add by tangyun

Innodb_data_home_dir = / mysql/data/mysqldata/ibdata

Innodb_log_group_home_dir=/mysql/data/mysqldata/ibdata

Log-bin-index=/mysql/data/mysqldata/binlog/mysql-bin.index

Log-bin=/mysql/data/mysqldata/binlog/mysql-bin

Innodb_buffer_pool_size = 512m

Innodb_buffer_pool_instances=4

Innodb_flush_log_at_trx_commit=2

Innodb_log_files_in_group=3

Innodb_log_file_size=256M

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

Join_buffer_size = 128m

Sort_buffer_size = 2m

Read_rnd_buffer_size = 2m

# add by tangyun

Performance_schema=0

Event-scheduler=ON

Default-storage-engine=InnoDB

Character_set_server=utf8mb4

Collation_server=utf8mb4_general_ci

Lower_case_table_names=1

Explicit_defaults_for_timestamp=true

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Optimizer_switch=index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=on,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on

# add by tangyun

# * * Logs related settings * *

# general_log

General_log_file=/mysql/data/mysqldata/log/general.log

Log-error=/mysql/data/mysqldata/log/error.log

Long_query_time=0.3

Slow_query_log = 1

Slow_query_log_file=/mysql/data/mysqldata/log/slow-query.log

# log_queries_not_using_indexes

Log_warnings = 2

Relay-log-index=/mysql/data/mysqldata/relaylog/mysql-relay-bin.index

Relay-log=/mysql/data/mysqldata/relaylog/mysql-relay-bin

Binlog_cache_size=256K

Max_binlog_size=512M

Binlog_format=mixed

Binlog_checksum=crc32

Sync_binlog=100

Expire_logs_days=10

# # add by tangyun

# * * Replication related settings * *

Server_id = 1000

# slave-skip-errors=1022,1032,1062

Log_slave_updates=1

Log_bin_trust_function_creators=1

Auto_increment_increment=2

Auto_increment_offset=1

Allow-suspicious-udfs

Innodb_support_xa=1

Sysdate-is-now

# gtid-mode=ON

# enforce_gtid_consistency

# disable_gtid_unsafe_statements

[mysqldump]

Quick

Max_allowed_packet=2G

Default-character-set=utf8

[mysql]

No-auto-rehash

Default-character-set=utf8

Show-warnings

Pager=mk-visual-explain

Prompt= "(\ u@\ h) [\ d] >"

[myisamchk]

Key_buffer=512M

Sort_buffer_size=512M

Read_buffer=8M

Write_buffer=8M

[mysqlhotcopy]

# interactive-timeout

[mysqld_safe]

# ledir=/usr/bin

User=mysql

Open-files-limit=8192

Initialize the MySQL database instance

# mysql_install_db-user=mysql-explicit_defaults_for_timestamp=true-datadir=/mysql/data/mysqldata/mydata

Installing MySQL system tables...2016-01-28 08:37:12 0 [Note] / usr/sbin/mysqld (mysqld 5.6.28) starting as process 10719.

2016-01-28 08:37:12 10719 [Note] InnoDB: Using atomics to ref count buffer pool pages

2016-01-28 08:37:12 10719 [Note] InnoDB: The InnoDB memory heap is disabled

2016-01-28 08:37:12 10719 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2016-01-28 08:37:12 10719 [Note] InnoDB: Memory barrier is not used

2016-01-28 08:37:12 10719 [Note] InnoDB: Compressed tables use zlib 1.2.3

2016-01-28 08:37:12 10719 [Note] InnoDB: Using Linux native AIO

2016-01-28 08:37:12 10719 [Note] InnoDB: Using CPU crc32 instructions

2016-01-28 08:37:12 10719 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2016-01-28 08:37:12 10719 [Note] InnoDB: Completed initialization of buffer pool

2016-01-28 08:37:12 10719 [Note] InnoDB: The first specified data file. / ibdata1 did not exist: a new database to be created!

2016-01-28 08:37:12 10719 [Note] InnoDB: Setting file. / ibdata1 size to 12 MB

2016-01-28 08:37:12 10719 [Note] InnoDB: Database physically writes the file full: wait...

2016-01-28 08:37:12 10719 [Note] InnoDB: Setting logfile. / ib_logfile101 size to 48 MB

2016-01-28 08:37:12 10719 [Note] InnoDB: Setting logfile. / ib_logfile1 size to 48 MB

2016-01-28 08:37:12 10719 [Note] InnoDB: Renaming logfile. / ib_logfile101 to. / ib_logfile0

2016-01-28 08:37:12 10719 [Warning] InnoDB: New log files created, LSN=45781

2016-01-28 08:37:12 10719 [Note] InnoDB: Doublewrite buffer not found: creating new

2016-01-28 08:37:12 10719 [Note] InnoDB: Doublewrite buffer created

2016-01-28 08:37:12 10719 [Note] InnoDB: 128rollback segment (s) are active.

2016-01-28 08:37:12 10719 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-01-28 08:37:12 10719 [Note] InnoDB: Foreign key constraint system tables created

2016-01-28 08:37:12 10719 [Note] InnoDB: Creating tablespace and datafile system tables.

2016-01-28 08:37:12 10719 [Note] InnoDB: Tablespace and datafile system tables created.

2016-01-28 08:37:12 10719 [Note] InnoDB: Waiting for purge to start

2016-01-28 08:37:12 10719 [Note] InnoDB: 5.6.28 started; log sequence number 0

2016-01-28 08:37:12 10719 [Note] Binlog end

2016-01-28 08:37:12 10719 [Note] InnoDB: FTS optimize thread exiting.

2016-01-28 08:37:12 10719 [Note] InnoDB: Starting shutdown...

2016-01-28 08:37:14 10719 [Note] InnoDB: Shutdown completed; log sequence number 1625977

OK

Filling help tables...2016-01-28 08:37:14 0 [Note] / usr/sbin/mysqld (mysqld 5.6.28) starting as process 10741.

2016-01-28 08:37:14 10741 [Note] InnoDB: Using atomics to ref count buffer pool pages

2016-01-28 08:37:14 10741 [Note] InnoDB: The InnoDB memory heap is disabled

2016-01-28 08:37:14 10741 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2016-01-28 08:37:14 10741 [Note] InnoDB: Memory barrier is not used

2016-01-28 08:37:14 10741 [Note] InnoDB: Compressed tables use zlib 1.2.3

2016-01-28 08:37:14 10741 [Note] InnoDB: Using Linux native AIO

2016-01-28 08:37:14 10741 [Note] InnoDB: Using CPU crc32 instructions

2016-01-28 08:37:14 10741 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2016-01-28 08:37:14 10741 [Note] InnoDB: Completed initialization of buffer pool

2016-01-28 08:37:14 10741 [Note] InnoDB: Highest supported file format is Barracuda.

2016-01-28 08:37:14 10741 [Note] InnoDB: 128rollback segment (s) are active.

2016-01-28 08:37:14 10741 [Note] InnoDB: Waiting for purge to start

2016-01-28 08:37:14 10741 [Note] InnoDB: 5.6.28 started; log sequence number 1625977

2016-01-28 08:37:14 10741 [Note] Binlog end

2016-01-28 08:37:14 10741 [Note] InnoDB: FTS optimize thread exiting.

2016-01-28 08:37:14 10741 [Note] InnoDB: Starting shutdown...

2016-01-28 08:37:16 10741 [Note] InnoDB: Shutdown completed; log sequence number 1625987

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:

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

/ usr/bin/mysqladmin-u root-h tony7 password' new-password'

Alternatively you can run:

/ usr/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 / usr; / usr/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

New default config file was created as / usr/my.cnf and

Will be used by default by the server when you start it.

You may edit this file to change server settings

5. Start the MySQL service process mysqld

Cp / usr/share/mysql/mysql.server / etc/init.d/mysqld

# service mysqld start

Starting MySQL... SUCCESS!

# netstat-npl | grep mysql

Tcp 0 0: 3306: * LISTEN 11254/mysqld

Unix 2 [ACC] STREAM LISTENING 21155 11254/mysqld / mysql/data/mysqldata/sock/mysql.sock

Change the login password and check the database parameters

Mysqladmin-u root-h tony7 password 'mysql'

[root@tony7] # mysql-uroot-pmysql-htony7

Warning: Using a password on the command line interface can be insecure.

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

Your MySQL connection id is 1

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

Copyright (c) 2000, 2015, 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 > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > set password for 'root'@'localhost' = password (' mysql')

Query OK, 0 rows affected (0.00 sec)

Mysql > use mysql

Database changed

Mysql > drop database test

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

+-+

3 rows in set (0.00 sec)

Mysql > show global variables like'% slow%'

+-+

| | Variable_name | Value |

+-+

| | log_slow_admin_statements | OFF |

| | log_slow_slave_statements | OFF |

| | slow_launch_time | 2 | |

| | slow_query_log | ON |

| | slow_query_log_file | / mysql/data/mysqldata/log/slow-query.log |

+-+

5 rows in set (0.00 sec)

Mysql > show global variables like'% log-bin%'

Empty set (0.00 sec)

Mysql > select user,host,password from mysql.user

+-- +

| | user | host | password | |

+-- +

| | root | localhost | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root | tony7 |

| | root | 127.0.0.1 |

| | root |:: 1 |

| | localhost |

| | tony7 |

+-- +

6 rows in set (0.00 sec)

Mysql > show global variables like'% event%'

+-+ +

| | Variable_name | Value |

+-+ +

| | binlog_rows_query_log_events | OFF |

| | event_scheduler | OFF |

| | log_bin_use_v1_row_events | OFF |

| | performance_schema_events_stages_history_long_size | 10000 | |

| | performance_schema_events_stages_history_size | 10 | |

| | performance_schema_events_statements_history_long_size | 10000 | |

| | performance_schema_events_statements_history_size | 10 | |

| | performance_schema_events_waits_history_long_size | 10000 | |

| | performance_schema_events_waits_history_size | 10 | |

+-+ +

9 rows in set (0.00 sec)

Mysql > show full processlist

+-+-

| | Id | User | Host | db | Command | Time | State | Info |

+-+-

| | 1 | root | localhost:24980 | mysql | Query | 0 | init | show full processlist | |

+-+-

1 row in set (0.00 sec)

Mysql > set password for 'root'@'tony7' = password (' mysql')

Query OK, 0 rows affected (0.00 sec)

Mysql > set password for 'root'@'127.0.0.1' = password (' mysql')

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host,password from mysql.user

+-- +

| | user | host | password | |

+-- +

| | root | localhost | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root | tony7 | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root | 127.0.0.1 | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root |:: 1 |

| | localhost |

| | tony7 |

+-- +

6 rows in set (0.00 sec)

Mysql > delete from mysql.user where host='::1'

Query OK, 1 row affected (0.00 sec)

Mysql > delete from mysql.user where host='tony7' and user=''

Query OK, 1 row affected (0.00 sec)

Mysql > commit

Query OK, 0 rows affected (0.00 sec)

Mysql > delete from mysql.user where host='localhost' and user=''

Query OK, 1 row affected (0.00 sec)

Mysql > commit

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > select user,host,password from mysql.user

+-- +

| | user | host | password | |

+-- +

| | root | localhost | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root | tony7 | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

| | root | 127.0.0.1 | * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA |

+-- +

3 rows in set (0.00 sec)

Mysql >

# export MYSQL_PS1= "(\ u@\ h) [\ d] >"

(root@localhost) [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

+-+

3 rows in set (0.00 sec)

Created by Tony.Tang [TangYun] 2016.01

-End-

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