In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to install MySQL in Ubuntu18.04. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Tip: the following operations are carried out under the authority of root.
# check whether MySQL is installed:
Dpkg-l | grep mysql
# install MySQL:
Apt install mysql-server
After the installation is complete, you can use the following command to check whether the installation is successful:
Netstat-tap | grep mysql
After passing the above command check, if you see that the socket with mysql is in the LISTEN state, the installation is successful.
You can log in to the mysql database by using the following command:
Mysql-u root-p
-u indicates the user name that chooses to log in, and-p indicates the login user password. Now there is no password in the mysql database. If you enter directly at Enter password:, you can enter the mysql database.
You can then view all the current databases through show databases;.
Next, in order to ensure the security and normal operation of the database, initialize the database. This initialization involves the following five steps.
(1) install the authentication password plug-in.
(2) set the proprietary password of the root administrator in the database.
(3) then delete the anonymous account and use the root administrator to log in to the database remotely to ensure the security of the business running on the database.
(4) delete the default test database and cancel a series of access rights to the test database.
(5) refresh the authorization list so that the initialization settings take effect immediately.
For the above database initialization steps, I made a simple comment next to the output below.
Root@ubuntu-virtual-machine:~# mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
And improve security. It checks the strength of password
And allows the users to set only those passwords which are
Secure enough. Would you like to setup VALIDATE PASSWORD plugin? # do you want to install the authentication password plug-in?
Press y | Y for Yes, any other key for No: n # here I choose N
Please set the password for root here.
New password: # enter the database password to be set for the root administrator
Re-enter new password: # enter the password again
By default, a MySQL installation has an anonymous user
Allowing anyone to log into MySQL without having to have
A user account created for them. This is intended only for
Testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
Environment.
Remove anonymous users? (Press y | Y for Yes, any other key for No): y # Delete an anonymous account
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
The root password from the network.
Disallow root login remotely? (Press y | Y for Yes, any other key for No): n # forbids root administrators from logging in remotely, but I don't prohibit it here
... Skipping.
By default, MySQL comes with a database named 'test' that
Anyone can access. This is also intended only for testing
And should be removed before moving into a production
Environment.
Remove test database and access to it? (Press y | Y for Yes, any other key for No): y # Delete the test database and cancel access to it
-Dropping test database...
Success.
-Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
Made so far will take effect immediately.
Reload privilege tables now? (Press y | Y for Yes, any other key for No): y # refresh the authorization table so that the initialization setting takes effect immediately
Success.
All done!
Check the status of the mysql service:
Systemctl status mysql
The following results show that the mysql service is running normally:
Once again, use the mysql-u root-p command, enter the password you just set at Enter password:, and enter enter to enter the mysql database.
Use the use mysql; command to open the mysql named database and display the table of the current database: show tables; queries the data in the user table: select * from user; (the user table contains all the account information of the mysql database)
Now that you configure mysql to allow remote access, first edit the / etc/mysql/mysql.conf.d/mysqld.cnf configuration file:
Vim / etc/mysql/mysql.conf.d/mysqld.cnf
Comment out bind-address = 127.0.0.1
Save the exit, then go to the mysql database and execute the authorization command:
Mysql-u root-pmysql > grant all on *. * to root@'%' identified by 'your password' with grant option;mysql > flush privileges; # Refresh permissions mysql > exit
Then execute the exit command to exit the mysql service, and then restart mysql by executing the following command:
Systemctl restartmysql
Now you can use the Navicat graphics tool under Windows to remotely connect to the MySQL database under Ubuntu and enter the password that has just granted remote permissions.
By the way, share here: Navicat for MySQL 10.1.7 installation package
Link: https://pan.baidu.com/s/12P1BcvQsRetBY0jGIvwILw&shfl=shareset extraction code: 8bft
The above is how to install MySQL in Ubuntu18.04. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.