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

Configuration tutorial for MySQL

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

Share

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

This article introduces the "MySQL configuration tutorial" related knowledge, in the actual case operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

Configure MySQL

Note that MySQL only allows local access by default under Ubuntu. If you want other machines to be able to access it, you need to change the / etc/mysql/my.cnf configuration file! Let's take it one step at a time:

After the default MySQL installation, the root user does not have a password, so first enter with the root user:

$mysql-u root

The reason for using-u root here is that I am now a regular user (firehare). If I don't add-u root, mysql will think that firehare is logging in. Note that I did not enter root mode here because it is not necessary. In general, it is not necessary to enter root mode when operating on a database in mysql, which is only possible when set up.

After entering mysql, the most important thing is to set the root user password in Mysql, otherwise, the Mysql service has no security to speak of.

Mysql > GRANT ALL PRIVILEGES ON *. * TO root@localhost IDENTIFIED BY "123456"

Note that I use 123456 as the password for root users here, but the password is not secure. Please use a mixed password of uppercase and lowercase letters and numbers, with no less than 8 digits.

If you want to access or control remotely, you need to do two things:

One is:

Mysql > grant all privileges on *. * to soak@ "%" identified by "123456" with grant option

Flush privileges

The first line of the command is explained as follows. *. *: the first * represents the database name; the second * represents the table name. This means that all tables in all databases are authorized to the user. Root: the root account is granted. "%": the authorized user IP can be specified, which means that any IP address can access the MySQL database. "password": assign the password corresponding to the account, where the password is replaced with your mysql root account password. Second:

$sudo gedit / etc/mysql/my.cnf

In the old version

> skip-networking = > # skip-networking

In the new version

> bind-address=127.0.0.1 = > bind-address= the IP of your machine

This allows other machines to access MySQL.

This is the end of the "MySQL configuration tutorial". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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