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 ubuntu16.0.4 installs mysql

2025-01-16 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 ubuntu16.0.4 installs mysql. You can check the relevant technical terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope this article on how ubuntu16.0.4 installs mysql can bring you some practical help.

Ubuntu16.0.4 install mysql

Apt-get update

Apt-get upgrade

Apt-get install mysql-server

Mysql5.7 is currently installed by default in this version.

Modify the character set:

Vim / etc/my.ini

Default-character-set=utf8

Lower_case_table_names = 0

Where 0: case sensitive, 1: case insensitive

Start:

Select user,host from mysql.user

Delete anonymous users:

Delete from mysql.user where user=''

Refresh permissions:

Flush privileges

Open port 3306:

Iptabels-An INPUT-p tcp-m state-- state NEW-m tcp-- dport 3306-j ACCEPT

You can also use:

Ufw allow 3306

Ufw allow mysql

Establish a user:

Insert into mysql.user (Host,User,Password) values ("localhost", "yk", password ("19851014"))

Create database mmal default character set utf8 collate utf8_general_ci

View permissions:

Select * from mysql.user\ G

Grant permissions:

Grant all privileges on mall.* to yk@'%' identified by 'mall' with grant option

Set password for root@localhost=password ('root')

Set password for root@127.0.0.1=password ('root')

Problem 1: problems encountered in the installation process.

Every time I install the software successfully in linux, I am used to uninstalling the software and reinstalling it, resulting in the following problems. The method is to find it on the Internet. I forgot the URL and apologized to the original.

If the installation is not successful:

1. The installation to Renaming removed key_buffer and myisam-recover options (if present) is stuck, and ctrl+C cannot exit. Finally, I closed the terminal and forced to exit, but I found that the use of sudo netstat-tap | grep mysql unexpectedly showed that it was started successfully, but there would be problems when entering the shell interface, prompting ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:YES) to find a bunch of methods on the Internet, which could not be solved.

But consider unloading and reloading:

Sudo apt-get autoremove mysql*-purge

Sudo apt-get remove apparmor / / this apparmor is installed in mysql-server fashion and is related to safety.

2. After restarting the computer (most of the time, reboot is a magic weapon), use the command apt-get to install mysql-server again, and run until Renaming removed key_buffer and myisam-recover options (if present) is still stuck. I aborted the terminal again and found that the startup was successful. I tried to enter the shell interface and there was another new error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ var/run/mysqld/mysqld.sock' (2) Then I found a lot of information at home and abroad. Baidu was unable to find out what was completely related to this error, but it was honest to go to Google. The proposed plan was to delete some duplicate configuration files, but I didn't even have this / var/run/mysqld/mysqld.sock, so I still couldn't solve it.

Uninstall again. Consider that you must uninstall it very thoroughly.

Sudo apt-get autoremove mysql*-purge

Sudo apt-get remove apparmor

Sudo rm / var/lib/mysql/-R / / is very important

Sudo rm / etc/mysql/-R / / is very important

3. Restart the computer and use the command sudo apt-get install mysql-server to install successfully again!

Problem 2: remote login MySQL service cannot be logged in:

Check whether the service is started:

Ps aux | grep mysql

Check port snooping:

Netstat-antp | grep 3306

If the listening shows that there is only 127.0.0.1 mysql5.7 3306: modify the configuration file first, and the configuration file is in

/ etc/mysql/mysql.conf.d/my.cnf

Change bind-address=127.0.0.1 to bind-address=0.0.0.0

If remote access is still not available: check that you do not have permission to grant remote access or specify ip access to the appropriate user.

Select host,user from mysql.user

Give the appropriate user permissions:

Update user set host='%' where user = 'root'

'%' means that any ip address can be accessed.

Flush privileges

Ubuntu16.0.4 is how to install mysql to tell you here, for other related issues you want to know can continue to pay attention to 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