Plesk CLI database --create: This object can be created only in a subscription - mysql

I'm using Plesk on a Linux root-server and want to write a simple deployment shell script.
To do that, I want to drop the database, create it again, and import a sql dump file.
I'm trying to create a database using:
plesk bin database --create myDbName -domain myDomain -type mysql -server localhost
But this gives me the following error:
This object can be created only in a subscription.
I was unable to find anything about this issue in the Plesk docs. How can I select the description that shall be used?
Thanks & regards

Most likely you specified addition domain on the subscription as myDomain.
According to Plesk business logic, databases are associated with the webspace (or the subscription), not with the separate domains on the same subscription.
Basically, you should specify the name of the default domain for the subscription, which is the same as subscription name itself.
You can get the list of subscription names using plesk bin subscription -l. Then use the required name to create a database. For example:
# plesk bin subscription -l
domain.ltd
...
# plesk bin database --create myDbName -domain domain.ltd -type mysql -server localhost

Related

Configure Azure MySQL Database firewall

I created an Azure MySQL Database for a school project, but i have issues with the firewall. Indeed, if i want my friends to connect to the database, i have to add manually their ip address to the firewall.
But the real problem is that i'm not sure that my teacher will accept to share his ip address with me, so he'll maybe not be able to evaluate my work.
So i have tried to disable the firewall (I don't need so much security it's just a school project, and the database will be removed after the evaluation), but i have only found solutions for Azure SQL Database that use settings that don't exist (or no longer exist) for Azure MySQL Database. I have also found this solution using the azure CLI:
https://learn.microsoft.com/en-us/azure/mysql/howto-manage-firewall-using-cli#:~:text=message%20text%20instead.-,Delete%20a%20firewall%20rule%20on%20Azure%20Database%20for%20MySQL%20Server,of%20the%20existing%20firewall%20rule
but the commands don't find my server, and if i execute this command:
az mysql server list --resource-group myresourcegroup
my resource group is found, but it returns an empty list, despite my server really appears in Azure GUI in this resource group
Can you help me to disable this firewall please.
The firewall rules I see in my database instance allow me to create a 0.0.0.0-255.255.255.255 IP range to allow all the hosts.
Obviously, this is not at all secure, but should 'disable' the firewall.
If you need to do it in CLI then the command would be:
az mysql server firewall-rule create --resource-group <rg-name> --server-name <server-name> --name DisableFirewall --start-ip-address 0.0.0.0 --end-ip-address 255.255.255.255
Maybe the teacher doesn't need to actually connect to the database? However, if he has access to the subscription and resource group then he will add his IP for the time he will review your solution if needed.

Specify a particular database query from command line with MySQL Workbench

I would like to facilitate opening a database UI for development projects (usually docker containers, bound to arbitrary ports on the host machine) by a generic command.
I wonder if it is possible to open MySQL Workbench and let it connect automatically from the command line.
Similar to giving connection parameters with the mysql console:
mysql --host=127.0.0.1 --port=$port --user=db --password=db db
I haven't found that specifically in the supported arguments, so either it is hidden or maybe possible with any of the other options?
EDIT:
Probably the way is to generate a file to pass to --query dynamically?
Here's the format for the mysqlworkbench --query parameter:
--query="$user:$password#$host:$port"
This feature already exists as an example in ddev - look in the ~/.ddev/commands/host/mysqlworkbench.example file. (See on github).
For ddev, the query is set up as query="root:root#127.0.0.1:${DDEV_HOST_DB_PORT}", which uses the root/root credentials, accesses the 'db' container via localhost on the port provided by ddev at $DDEV_HOST_DB_PORT.

Why don't I have access to the database from aws lambda but have from a local computer with the same login data?

I created a new Mysql database in Amazon RDS, and on my local computer I get access through the console
mysql -u username -p -h test.c2nfdg67dbdpb.us-east-1.rds.amazonaws.com
Now I try to connect via Aws Lamda using python and pymysql module
rds_host = "test.c2nfdg67dbdpb.us-east-1.rds.amazonaws.com"
name = 'username'
password = 'pass'
db_name = 'dbtest'
conn = pymysql.connect(rds_host, user=name, passwd=password, db=db_name, connect_timeout=5)
and got an error ERROR] 2019-11-20T14:30:05.261Z 7b1ed2e0-03ba-4c62-9525-22d84582f (1049, "Unknown database 'dbtest'")
It seems strange that I don't use the database name at all through the local console and I get access.
p.s.I run show databases; on local console and cant see dbtest in databaselist. I was confused because when I created the new database, I entered a name, but only default databases are listed. What am I connected to then?
p.s.s
hm why DB name is undefined ?
Your code explicitly tries to connect a specific database named dbtest. It will either connect to this database or fail, contrary to your mysql client which can connect without a database selection. Clearly, the database is missing, since you verified that show databases results does not include dbtest.
Then only possible explanation is that the database was never created.
The RDS console provides the ability to create a database with default settings. That's the way I used it. But no physical database is created, only database instances.
I can't found a way to add a new database to the created instance. Now, after a few hours of troubleshooting, I recreated the new database without using the default settings and there was a point - database name entry. I added this name and everything worked out.
But here's what I don't understand is why AWS added a quick creation way, which in the end doesn't actually create a database that you can join.
If you have created the database in Amazon RDS and are able to connect to it from your local computer, it may be a connection/permission issue with your lambda. Your Lambda function may be inside a VPC subnet with no internet access. Either pull it out of the VPC or grant internet access to the Lambda function like this:
https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/
However, if your Lambda function will be communicating with RDS instances, you should consider doing this via private channels for security purposes.
Update
A third possibility is that the database in question doesn't exist even though the asker implies that there was a successful connection to the database from his/her local computer.

mysql host on internet using hp cloud and xeround

I am new to the 'cloud' concept I have a Java based application for data entry which runs well on my LAN.
On my LAN I install:
MySql
Configure Instance ( user name - root, pass - ******)
Dump dummy database entry_db that is in raw format
Then I have a jar executable file which when runs, displays a login screen.
I manage to successfully log in using predefined ID and PASSWORD (user - config pass - ******)
After logging in I configure(d):
Database Type
Database IP
User Name (Root)
Password ****
Database Name ( It auto selects database named entry_db)
In another window I configure(d) Network File Sharing Location:
file shared location
image path
back up data path
config file location in xml
(Note - When I select file shared location, all other files take the same path automatically)
Then I create Admin account rather than Supervisor account or operator account and login with the Admin account and I can now upload data and distribute to all operators.
Here is my problem:
I configure a cloud computer on Hp Cloud (they provide me a static ip) and then import database from xeround.com.
I now have a dns and port number and also a log in form using MY PHP CLIENT
How can I package all this to the same executable jar file to be used from anywhere?
How can I use it just like on my LAN from the web?
What is the optimal configuration for this?
I work in Xeround.
I have read your question and I wanted to point out a couple of things; you should use the DNS in the connection string where you used to put hostname/IP of the MYSQL server machine and the port number where you used to put the MySQL default port (3306).
 
Other than that you can connect from anywhere there is access to the instance. I suggest that if your jar runs in the HP cloud you create your Xeround database instance there as well (this will yield improved performance).
 
If you still need help, we will be more than happy to help you. Just send us a quick email to support#xeround.com and we'll take it from there.
Cheers,
Yuval

Ejabberd mnesia database to mysql

I have an mnesia database dump from an ejabberd server (DCD, DCL, and DAT files), and I'm trying to recover any data I can from this database. It would be ideal to convert it to some kind of SQL database, however I would settle for a simple text dump (from there I could probably rebuild the database).
I'm an erlang/mnesia newbie, but here is what I managed to do from the online docs:
bash$> erl -mnesia dir '"ejabberd_dump_dir"'
...Erlang loads...
1> mnesia:start().
2> mnesia:info().
[snip]
stopped db nodes = [ejabberd_dump_dir]
[snip]
remote = [ list of the tables from ejabberd_dump_dir ]
[snip]
3> tv:start().
When tv starts it simply shows to table names and says they have 0 records. I'm guessing there's some way of loading it into memory again, but I have yet to figure out how based on the docs.
Another thought I had was to attempt to load it using another installation of ejabberd, however it seems the only way to this using ejabberdctl is to load it from a text file.
How do I load this database and either dump it into sql or dump it to a format that can be imported by sql? What am I missing?
UPDATE: I've been attempting to restore this database to a temporary ejabberd server like so:
bash$> ejabberdctl --auth admin ejabberd passwd restore ejabberd /home/user/ejabberddmpdir/
bash$> ejabberdctl --auth admin ejabberd passwd export2odbc ejabberd /home/user/mnesiatosql/
The first command fails and forced me to conclude I'm quickly losing the war between man and machine. I'm not positive, but I think that using ejabberd as the host will use localhost as the node. Any ideas?
UPDATE: I think it might be a permissions issue as trying to export the default ejabberd db will result in {{badmatch,{error,eacces}} among other errors. This email shows the error I'm getting, but I'm not sure why.
Ejabberd can dump its mnesia database to a structured text file using the ejabberdctl utility:
ejabberdctl dump /tmp/ejabberd.db.txt
I'm still working out the details as to how the whole mnesia node system works, but I ended up using this to load the database into mnesia:
bash$> erl -name ejabberd#localhost -mnesia dir '"/home/usr/ejabberd#localhost/"'
Thanks to anyone who took a look.
based on the man page of ejabberdctl
ejabberdctl export2odbc host directory
ejabberdctl export2odbc localhost /tmp/sql