How can I connect to a local SQL server? - mysql

I want to create my own database with my tables to practice some SQL. I cannot create a database unless i connect to a server. I have tried Microsoft SQL Server Management Studio and MySQL Workbench but both failed.
In Microsoft SQL Server Management Studio, I tried:
Server Type: Database Engine
Server Name: "DESKTOP-MUO9FQ2" and "." and "local"
Authentication: Windows Authentication
GRAYED OUT:
Username: DESKTOP-MUO9FQ2\15072
Password:
In MySQL Workbench:
Connection Name: localhost
Host Name: 127.0.0.1
Port: 3306 and 1433
Username: root
How can I connect to any server so I can create my own database and play around with my data using SQL?

I installed MySql which includes MySql CLI, and it works fine.
You just have to install MySql and you will have the CLI includes.
In the installation, you will have to define a root user and a user each with password.
Then run MySql CLI and you will have to enter the root password you choose, and then it's done.
Now you can can create databases ,tables and so on...

Related

IAM authentication to connect with any SQL client to Amazon RDS for MySQL

I can connect to the MySQL RDS database using IAM authentication from the SQL command line tool. But the same I need to achieve connections with SQL clients like DBeaver or some other clients. I don't have the provision of passing tokens in SQL client.
This document explains connecting RDS using MySQL workbench/j but I am unable to download the MySQL workbench/j due to a forbidden error. https://aws.amazon.com/blogs/database/use-iam-authentication-to-connect-with-sql-workbenchj-to-amazon-aurora-mysql-or-amazon-rds-for-mysql/
Could someone help me in connecting RDS using IAM authentication from an SQL client?
In fact you could use the aws rds command to generate each time a new token to use as your password to authenticate the database. But since you want to do it with deaver, looks like its available (https://dbeaver.com/docs/wiki/AWS-Credentials/) but only in Enterprise edition (not the community edition)
If you're going to use DBeaver
The proper connection details :
Server Host: Endpoint address
Port: 3306
Database: DB name
User name: Database master username
Password: Database master password
1
2

percona xtrabackup considering local mysql socket as default even when host parameter is passed

Trying to take a full back up of MySQL database which is in network. I have pass the host param but still it is taking backup of database in my local machine using local mysql socket at /var/lib/mysql/mysql.sock
When i am trying execute below command
xtrabackup --backup --host='192.168.10.280' --databases="sampledb" --user=dbuser --password=dbpasswd --target-dir=/mnt/s3-restore/bkup
I get the below output
200415 19:42:00 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=192.168.10.280;port=3306;mysql_socket=/var/lib/mysql/mysql.sock' as 'dbuser' (using password: YES)
200415 19:42:00 version_check Connected to MySQL server
200415 19:42:00 version_check Executing a version check against the server...
200415 19:42:00 version_check Done.
200415 19:42:00 Connecting to MySQL server host: 192.168.10.280, user: sampledb, password: set, port: 3306, socket: /var/lib/mysql/mysql.sock
Using server version 5.6.43-log
Wanted to know Is it mandatory to take the backup on the same machine. If not than what param do i am missing.
Worked on this and figured out that Percona Xtrabackup will need access to '/var/lib/mysql' where the host database resides. This is read from your my.cnf and can be pulled in the actual SQL cli when you ask for #datadir.
Xtrabackup requires access to MySQL's data directory (and MySQL instance as well), so it can't be run on another server. However, it can be triggered by another server with SSH (or alternative solution).
For example:
ssh serverA "innobackupex --stream=xbstream /var/lib/mysql" > backup.xbstream

Trying to connect to VM VirtualBox MySQL from Windows 7 using MySQL Workbench

I am trying to save myself some time and eye strain by connecting my to MySQL on my VM (Ubuntu 14.04)
I have a bridged connection set up, and I test my web applications on my windows by simply navigating to http://ip_of_vm/application/index.php, so I know that they are communicating. However, when I tried setting up the connection in MySQL Workbench, I come to a screeching halt. Here are my connection parameters:
Hostname: ip_of_vm
Port: 3306 (Default)
Username: tim -> Which is a user created on my VM using: CREATE USER 'tim'#'%' in MySQL
Password: **** -> No I'm not going to paste my password here.
Default Schema: test_database
But when I press test connection I get this error:
Failed to connect to MySQL at ip_of_vm with user tim.
Can't connect to MySQL server on ip_of_vm (10061)
I've tried searching for that error code and making some adjustments based on what I've found, but I'm still having no luck.
Any suggestions would be greatly appreciated.

Migrate MS SQL Server database to MySQL using Workbench migration wizard over ssh

I am trying to migrate a SQL Server 2008 database to MySQL. The MySQL database is on a vps on digital ocean. In the migration process, the source selection was successfull but the target selection is not. For the target selection, I used the connection method as Standard TCP/IP over SSH. Clicking on Test connection gives the error "Unsupported connection method. MySQL connections over SSH are not supported in this version of MySQL workbench migration wizard."
I have MySQL version 6.1
These are the parameters I used:
SSH Hostname: host IP address:22
SSH Username: root
SSH Password: host password
SSH KeyFile: I did not set up a key file for my MySQL db. Is it required?
MySQL HostName: 127.0.0.1
MySQL Server port: 3306
username: root
password: password to MySQL
Please tell me if I am missing something or if I am giving the parameters wrong.
Do I have to set the ssh key file to migrate the database over ssh?
Note
The migration process does not support source or target RDBMS connections through SSH.
A workaround is to set up an encrypted tunnel, and then treat the MySQL target as a standard TCP (unencrypted) connection.
I found this note on the MySQL Workbech documentation for migration wizard. Heres the link
http://dev.mysql.com/doc/workbench/en/wb-migration-install.html
I do not know how to do the migration with the suggested work around. Any help will be greatly appreciated.
Thanks.
This is what I did:
First, Install MySQL on the same machine where the MS SQL Server database exists. Use the MySQL Migration wizard to migrate the database locally. Now there are two options here.
OPTION 1: Create a backup file for the migrated database in MySQL. Use this backup file and restore database in the target MySQL.
OPTION 2: Export each table from the migrated database in MySQL to .csv files and then copy these files to the server and import them in to the target MySQL database.

Database connection to remote machine in ruby on rails

Here is strange problem.
databse server ip : 170.2.14.131
application server ip : 170.2.14.137
Application is on cloud server. Database server is on another instance
and application hosted on different instance.
production:
adapter: mysql
database: database_name
username: ************
password: ************
host: 170.2.14.131
This is my database.yml configuration for production environment.
Now when i am trying to connect through my application it's using
application server IP instead of remote databse IP.
Please suggest.
By default, MySQL database server remote access disabled for security reasons. there're 3 solutions to this problem, i'll not describe them here, you can read about it in my blog here:
http://notes.kloop.kg/2011/11/17/enable-remote-access-to-mysql-database-server/