【问题标题】:Unable to configure mysql database, after cloud sql proxy setup云sql代理设置后无法配置mysql数据库
【发布时间】:2019-05-11 23:50:39
【问题描述】:

根据此链接配置云 sql 代理 https://cloud.google.com/sql/docs/mysql/connect-admin-proxy

启用 Cloud SQL Admin API。使用以下命令连接到 mysql 时出现错误

[prudvee143@centos-2 ~]$ mysql -h 127.0.0.1 -u root -p
Enter password: 
2018/12/11 02:21:34 New connection for "bookshelfs-221608:us-central1:test"
2018/12/11 02:21:34 couldn't connect to "bookshelfs-221608:us-central1:test": ensure that the account has access to "bookshelfs-221608:us-central1:test" (and make sure there's no typo in that name). Error during createEphemeral for bookshelfs-221608:us-central1:test: googleapi: Error 403: Access Not Configured. Cloud SQL Admin API has not been used in project 317520816688 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=317520816688 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

用于此的命令:

wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy

[prudvee143@centos-2 ~]$ 2018/12/11 02:14:55 failed to setup file descriptor limits: failed to set rlimit {&{8500 4096}} for max file descriptors: invalid argument
2018/12/11 02:14:55 using credential file for authentication; email=sql-651@bookshelfs-221608.iam.gserviceaccount.com
2018/12/11 02:14:55 Listening on 127.0.0.1:3306 for bookshelfs-221608:us-central1:test
2018/12/11 02:14:55 Ready for new connections

【问题讨论】:

    标签: mysql google-cloud-platform google-cloud-sql


    【解决方案1】:

    解决办法是启用Cloud SQL API

    您可以使用 Google Cloud Console 启用 API:

    1. 转到APIs & Services
    2. 转到Library
    3. Search for APIs & Services 中输入SQL
    4. 选择Cloud SQL Admin API
    5. 点击Enable

    您还需要启用Cloud SQL。重复上述步骤。

    【讨论】:

    • 两者都启用了,仍然出现failed to setup file descriptor limits: failed to set rlimit {&{8500 4096}} for max file descriptors: invalid argument 错误
    • @Devy - 创建一个新问题并包含有关您的配置的详细信息。确保计费功能已启用且正常工作。
    • @NicolaAmadio 我不记得了。那是很久以前的事了,我相信在那之后我从 MySQL 切换到了 PostgreSQL。
    猜你喜欢
    • 2021-11-13
    • 2018-03-15
    • 2016-08-21
    • 1970-01-01
    • 2018-04-12
    • 2019-10-16
    • 1970-01-01
    • 2018-09-12
    • 1970-01-01
    相关资源
    最近更新 更多