MySQL Connect Command Line |Mt Buzzer

MySQL Connect Command Line



MySQL Connect Command Line

Login to MySQL server from the command line:-


In Windows, MySQL, as a matter of course, is introduced in the envelope %systemdrive%Program FilesMySQL. For instance, if the framework drive is C:, at that point the establishment catalog for MySQL server 5.5 would be C:Program Files MySQL MySQL Server 5.5

We can interface with MySQL server by running the mysql.exe situated in the receptacle envelope in the MySQL establishment registry.

In the event that you simply run MySQL without passing any contentions, you can interface with the server with the mysterious record. This works just if the unknown record isn't debilitated. When you introduce MySQL, as a matter of course, it empowers mysterious access.

Connect to MySQL as root:


You can connect to MySQL server by specifying the username and password in the command line arguments to mysql command. To connect as root-

mysql.exe -uroot -ppassword


You will be prompted for a password if -p option is skipped. If MySQL service is not running then the command would fail with the below error

C:>mysql.exe -u root -ppassword
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

You can create a desktop batch file to launch MySQL client as follows:


1. Make a content record and name it as mysql.bat.
2. Add the accompanying order to the mysql.bat document.
3. cmd/K "C:Program FilesMySQLMySQL Server 5.5binmysql.exe" - uroot - ppassword
4. Change the mysql.exe way according to your MySQL server form and introduce registry.
5. Spare the record. Presently onwards you can interface with the server by simply double tapping on the batch file.

An elective path is to make a work area alternate route with the objective as C:Program FilesMySQLMySQL Server 5.5binmysql.exe. In the wake of making the alternate route, open the properties and include - uroot - ppassword to the objective field.

The default establishment of MySQL makes an easy route in Start menu-> All Programs with the objective as beneath. You can utilize it as the objective for your work area easy route.

"C:Program FilesMySQLMySQL Server 5.5binmysql.exe" "--defaults-file=C:Program FilesMySQLMySQL Server 5.5my.ini" "-uroot" "-ppassword"


To connect to MySQL database on Windows through Command line, there are some steps to be followed:-


1. You have to begin the MySQL benefit, you can go to Start->Control Panel->System and Securities->Administrative Tools->Component Service->Services(local), at that point on the correct board, you can discover one administration name called MySQL and you should begin this administration

2. Go the MySQL establishment organizer, which is something like this : C:Program FilesMySQLMySQL Server 5.1. In this organizer, discover the receptacle envelope.

3. Open a charge comfort and change the working registry to C:Program FilesMySQLMySQL Server 5.1bin (You may change this as indicated by you MySQL establishment envelope). And after that write mysqld to begin the MySQL server. You can check the status of the mysql server by beginning the errand chief to check whether the mysqld procedure is available or you can type mysqladmin - u <username> - p <password> form to check whether it works or not.

4. Next, you have to begin the mysql customer, which is the mysql.exe document in an indistinguishable envelope from the mysqld.exe. On a similar order reassure, type mysql - u <username> - p <password> to interface with the server.

5. In the event that the association is fruitful, the mysql> provoke will appear. On the off chance that the association comes up short, you may check whether you write the right username and secret word.

6 After fruitful association, you can type SHOW DATABASES; to check the databases on the MySQL server.


Sometimes if we want to run MySQL but we don't have phpMyAdmin installed. What should we do?

On Windows we can run MySQL in following steps:


1. Open Console Window->Type "mysqld - u root". This implies we begin the mysql server with username root. This program will deal with every one of the correspondences between our support window and the genuine information;

2. In the wake of beginning the server, we have to utilize a customer to associate with the server and speak with it. the mysql program is appropriate for this. Next in the summon reassure, we compose "mysql - u root - p" to interface the server. As a matter of course, after the installation, the default watchword for client root is clear. On the off chance that you have changed the watchword, if it's not too much trouble enter your new secret key after the provoke "Enter watchword:";

3. In the event that all go well, congrats, you have effectively associated with the server and next you can utilize a few charges from this connect to deal with ensuing database preparing.


HOW TO REPAIR A MYSQL DATABASE THROUGH LINUX AND WINDOWS COMMAND LINE?


Repair MySQL Database through Linux Terminal(SSH):

1. Login to your Linux VPS utilizing Secure Shell (SSH) and interface with MySQL from the order line.

mysql -uUsername -p // Replace Username with your username.

2. Enter MySQL client secret word and hit Enter. You will see mysql provoke showing up. Presently, with a specific end goal to show all databases, type following command at mysql provoke.

show databases;

3. mysqlcheck empowers you to check databases without ceasing the whole MySQL benefit. - r contention is utilized to repair the ruined tables. mysqlcheck utility effectively chips away at both MyISAM and InnoDB database motors. Enter the following charge to repair MySQL database.

mysqlcheck -r [database] // Replace database name with your database name.


Repair MySQL Database through Windows Command Line:


1. Log in to your Windows VPS utilizing Remote Desktop.

2. Go to Start and find Command Prompt. Right snap Command Prompt and select Run as Administrator choice.

3. At windows summon incite explore to MySQL receptacle catalog as takes after.

cd C:Program FilesMySQLMySQL Server 5.5bin  //  Replace your MySQL bin directory path here.
Posted in: , ,


Liked us? Tell your friends on Facebook!

0 comments:

Post a Comment