To summarize ,
3306 default port of mysql
Login as root.
Start the database: /etc/rc.d/init.d/mysqld start
Databases located in: /var/lib/mysql/
Default config file installed by RPM: /etc/my.cnf
The first task is to assign a password:
[prompt]$ mysqladmin -u root password 'new-password'
Create a database: (Creates directory /var/lib/mysql/bedrock)
[prompt]$ mysqladmin -h localhost -u root -ppassword create bedrock
(or use SQL command: CREATE DATABASE bedrock;)
Add tables, data, etc: Connect to database and issue the following SQL commands:
[prompt]$ mysql -h localhost -u root -ppassword
...
mysql> use bedrock; - Define database to connect to. Refers to directory path: /var/lib/mysql/bedrock
mysql> create table employee (Name char(20),Dept char(20),jobTitle char(20));
mysql> DESCRIBE employee; Shutting down the database:
[prompt]$ mysqladmin -u root -ppassword shutdown - PREFERRED
OR
[prompt]$ /etc/rc.d/init.d/mysqld stop
OR
[prompt]$ service mysqld stoplt;/b> mysqladmin -h localhost -u root -ppassword create bedrock
Ref: http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html
3306 default port of mysql
Login as root.
Start the database: /etc/rc.d/init.d/mysqld start
Databases located in: /var/lib/mysql/
Default config file installed by RPM: /etc/my.cnf
The first task is to assign a password:
[prompt]$ mysqladmin -u root password 'new-password'
Create a database: (Creates directory /var/lib/mysql/bedrock)
[prompt]$ mysqladmin -h localhost -u root -ppassword create bedrock
(or use SQL command: CREATE DATABASE bedrock;)
Add tables, data, etc: Connect to database and issue the following SQL commands:
[prompt]$ mysql -h localhost -u root -ppassword
...
mysql> use bedrock; - Define database to connect to. Refers to directory path: /var/lib/mysql/bedrock
mysql> create table employee (Name char(20),Dept char(20),jobTitle char(20));
mysql> DESCRIBE employee; Shutting down the database:
[prompt]$ mysqladmin -u root -ppassword shutdown - PREFERRED
OR
[prompt]$ /etc/rc.d/init.d/mysqld stop
OR
[prompt]$ service mysqld stoplt;/b> mysqladmin -h localhost -u root -ppassword create bedrock
Ref: http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html
No comments:
Post a Comment