views
Steps
Find the MySQL program (Should be in a subdirectory called bin under the directory where MySQL was installed) E.g. Windows users: C:\mysql\bin\mysql.exe E.g. Linux/Unix users: /usr/local/mysql/bin/mysql
Start MySQL - At the command prompt, type: mysql -h hostname -u username -p, where host is the machine where the MySQL server is running username is the MySQL account you want to use -p will make MySQL prompt you for the MySQL account password.
Enter your password when prompted.
Type your SQL command followed by a semi-colon (;) and press the Enter key. The response from the server should be displayed on your screen. Get out of MySQL, type quit at the prompt and press the Enter key.Send Sql Queries to Mysql from the Command Line Step 5 Version 2.jpg
Running without the console.
Find the MySQL program (Should be in a subdirectory called bin under the directory where MySQL was installed) E.g. Windows users: C:\mysql\bin\mysql.exe E.g. Linux/Unix users: /usr/local/mysql/bin/mysql
Start MySQL. At the command prompt, type: mysql -h hostname -u username -p db_name -e "query" where host is the machine where the MySQL server is running username is the MySQL account you want to use -p will make MySQL prompt you for the MySQL account password. db_name is the name of the database to run the query in, and, query is the query that you want to run.
Enter your password when prompted. MySQL should return the result of your query.Send Sql Queries to Mysql from the Command Line Step 9 Version 2.jpg
Comments
0 comment