Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

connect xampp mysql on cmd windows

To access SQL via the command line we simply navigate to the xampp folder. the folder is usually on the c: drive.

type: cd c:xamppmysqlin then press enter.
type: in mysql -u root -p then press enter.
in the new line enter the password of the database.
type: show databases; to see all the databases that you have access to.
once you know what database you want to use type (ex. cms_database), type use cms_data or any other db_name, it should say Database changed
// Bonus Note you shouldn't use the root user when working with databases. you would want to create a separate account (ex. cms_user) with special privileges to limit errors.

to do that type:

GRANT ALL PRIVILEGES IN cms_database.*
TO 'cms_user'@'localhost' 
IDENTITIED BY 'yourpassword'
double check by using the command:

SHOW GRANT FOR 'cms_user'@localhost;
if you already have the name of the user and the specific database you wish to use, change step 2 to this.

mysql -u cms_user -p cms_database 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #connect #xampp #mysql #cmd #windows
ADD COMMENT
Topic
Name
5+2 =