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

MySQL ERROR 1227 (42000) under Mac: Access denied; you need (at least one of)

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

Share

Shulou(Shulou.com)06/01 Report--

MySQL under Mac (only with one library)

AC-IT002deMacBook-Pro:bin ac-it002 $mysql-u root-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 61

Server version: 5.6.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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 > show databases

+-+

| | Database |

+-+

| | information_schema |

| | test |

+-+

2 rows in set (0.00 sec)

Mysql >

Error report:

When creating a database:

Create user newUser

: ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege (s) for this operation

ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege (s) for this operation

Solution:

All are operated under the terminal command line. It is recommended to reset the path before the operation.

Method 1:

1. Close mysql

# service mysqld stop

two。 Shielding permission

# mysqld_safe-skip-grant-table

The screen appears: Starting demo from.

3. Open a new terminal input

# mysql-u root mysql

Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'

Mysql > FLUSH PRIVILEGES;// remember to use this sentence, otherwise if you close the previous terminal, the original error will occur again.

Mysql >\ Q

Method 2:

1. Close mysql

# service mysqld stop

two。 Shielding permission

# mysqld_safe-skip-grant-table

The screen appears: Starting demo from.

3. Open a new terminal input

# mysql-u root mysql

Mysql > delete from user where USER=''

Mysql > FLUSH PRIVILEGES;// remember to use this sentence, otherwise if you close the previous terminal, the original error will occur again.

Mysql >\ Q

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | d0 |

| | d7 |

| | mysql |

| | performance_schema |

| | ptsub |

| | test |

+-+

7 rows in set (0.00 sec)

Mysql > UPDATE user SET Password=PASSWORD ('123456') where USER='root'

ERROR 1046 (3D000): No database selected

Mysql > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > UPDATE user SET Password=PASSWORD ('123456') where USER='root'

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4 Changed: 4 Warnings: 0

Mysql > FLUSH PRIVILEGES

Query OK, 0 rows affected (0.00 sec)

Mysql >\ Q

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