In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Lamp or lnmp environment is built. If mysql is installed independently, authorization is required:
Install mysql independently on a single server
After installation, optimize the server.
Authorization
Example 1:
# create user demo, password demo123
Mysql > create user demo@localhost identified by 'demo123'
Query OK, 0 rows affected (0.00 sec)
# you can only log in at this time because there is no authorization
Mysql > show grants for demo@localhost
+-+
| | Grants for demo@localhost |
+-+
| | GRANT USAGE ON *. * TO 'demo'@'localhost' IDENTIFIED BY PASSWORD' * 2CADADD54086D5EB4C9F10E0430084D7F179885C' |
+-+
1 row in set (0.00 sec)
# authorize local login
Mysql > grant all on test.* to 'demo'@'localhost'
Query OK, 0 rows affected (0.01 sec)
# check the authorization status
Mysql > show grants for demo@localhost
+-+
| | Grants for demo@localhost |
+-+
| | GRANT USAGE ON *. * TO 'demo'@'localhost' IDENTIFIED BY PASSWORD' * 2CADADD54086D5EB4C9F10E0430084D7F179885C' |
| | GRANT ALL PRIVILEGES ON `test`.* TO 'demo'@'localhost' |
+-+
2 rows in set (0.00 sec)
-
Example two
Authorize all databases to connect to myuser from the local area network 10.89.1.0
GRANT ALL PRIVILEGES ON *. * TO 'myuser'@'10.89.1.%'IDENTIFIED BY' mypassword'
FLUSH PRIVILEGES
Mysql > select user,host from mysql.user
+-+ +
| | user | host |
+-+ +
| | tom |% | |
| | tom1 |% | |
| | tom2 |% | |
| | root | 127.0.0.1 | |
| | myuser | 10.89.1% | |
| | myuser | localhost |
| | myuser | localhost |
| | root | localhost |
| | tom | localhost |
| | root | mysql |
+-+ +
10 rows in set (0.01 sec)
# client connection testing
# if it is 3306 by default, it does not need to be added. Here, multi-instance testing is used. The port is 3308.
[root@weblnmp] # mysql-umyuser-pmypassword-h 10.89.1.30-P3308
Welcome to the MySQL monitor. Commands end with; or\ g.
Your MySQL connection id is 7
Server version: 5.5.32-log Source distribution
Copyright (c) 2000, 2013, 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 >
5.web server connection test
[root@weblnmp blog] # vi test_mysql.php
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.