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

Related configuration of mysql

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "the related configuration of mysql". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "the relevant configuration of mysql"!

After you install Mysql in Linux, you need to make some configuration.

Modify / etc/my.cnf as needed, refer to the configuration:

[mysqld]

# default to INNODB table, supporting transactions and row locks:

Default-storage-engine=INNODB

# set the default character set:

Default-character-set=utf8

# maximum buffer size used for client communication

Max_allowed_packet=16M

Start MySQL:

Service mysql start

/ etc/init.d/mysql start

/ usr/share/mysql/mysql.server start

[mysql.server]

# comment out the basedir line, otherwise MySql may not start

# it is said to be the bug of MySql

# basedir=/var/lib

Let the MySQL system start automatically when it starts:

Tick MySql in system Settings > Server Settings > Services

When root logs in, automatically starts mysql:

Add 1 line to the / root/.bash_profile file:

/ usr/share/mysql/mysql.server start

View the startup log:

/ var/log/messages

Show all users of MySQL:

Use mysql

Select host,user,password from user

Add a MySQL user (user name:user1,password:sql):

Grant all on *. * to user1@'%' identified by 'sql' with grant option

Delete a MySQL user:

Delete from user where user='user1'

Eg: the configuration of my machine

[client]

Port = 3306

Socket=/var/lib/mysql/mysql.sock

Default-character-set=utf8

[mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

Default-character-set=utf8

# Default to using old password format for compatibility with mysql 3.x

# clients (those using the mysqlclient10 compatibility package).

Old_passwords=1

[mysqld_safe]

Log-error=/var/log/mysqld.log

Pid-file=/var/run/mysqld/mysqld.pid

Default-character-set=utf8

-

Sorted out the following four ways to change the root password in MySQL, which may be helpful to you!

Method 1: use the SET PASSWORD command

Mysql-u root

Mysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' newpass')

Method 2: use mysqladmin

Mysqladmin-u root password "newpass"

If root has already set a password, use the following methods

Mysqladmin-u root password oldpass "newpass"

Method 3: edit the user table directly with UPDATE

Mysql-u root

Mysql > use mysql

Mysql > UPDATE user SET Password = PASSWORD ('newpass') WHERE user =' root'

Mysql > FLUSH PRIVILEGES

You can do this when you lose your root password

Mysqld_safe-skip-grant-tables&

Mysql-u root mysql

Mysql > UPDATE user SET password=PASSWORD ("new password") WHERE user='root'

Mysql > FLUSH PRIVILEGES

At this point, I believe you have a deeper understanding of the "relevant configuration of mysql", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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