Access mysql remote database from command line

后端 未结 17 1581
忘掉有多难
忘掉有多难 2020-11-28 01:41

I have a server with Rackspace. I want to access the database from my local machine command line.

I tried like:

mysql -u username -h my.application.com         


        
17条回答
  •  醉酒成梦
    2020-11-28 02:25

    I was too getting the same error. But found it useful by creating new mysql user on remote mysql server ans then connect. Run following command on remote server:

    CREATE USER 'openvani'@'localhost' IDENTIFIED BY 'some_pass';
    GRANT ALL PRIVILEGES ON *.* TO 'openvani'@'localhost WITH GRANT 
    OPTION;
    CREATE USER 'openvani'@'%' IDENTIFIED BY 'some_pass';
    GRANT ALL PRIVILEGES ON *.* TO 'openvani'@'%' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    

    Now you can connect with remote mysql with following command.

    mysql -u openvani -h 'any ip address'-p
    

    Here is the full post:

    http://openvani.com/blog/connect-remotely-mysql-server/

提交回复
热议问题