# mysql --version 
mysql  Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0
# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.soc
k' (2)
to resolve :
# sudo mysql_install_db --user=mysql
Set password:
/usr/bin/mysqladmin -u root password 'new-password'
start engine:
# sudo /usr/bin/mysqld_safe & 
Starting mysqld daemon with databases from /var/lib/mysql
# ps -efa| grep mysql
root     20687  4414  0 23:19 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql    20730 20687  0 23:19 pts/2    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
rtg      20749  4414  0 23:19 pts/2    00:00:00 grep mysql
change password:
#  sudo /usr/bin/mysqladmin -u root password 'NEWpassword'
login and issue some commands:
# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> 
mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| mysql              | 
| test               | 
+--------------------+
3 rows in set (0.00 sec)
mysql> help contents
You asked for help about help category: "Contents"
For more information, type 'help 
categories:
   Account Management
   Administration
   Data Definition
   Data Manipulation
   Data Types
   Functions
   Functions and Modifiers for Use with GROUP BY
   Geographic Features
   Language Structure
   Storage Engines
   Stored Routines
   Table Maintenance
   Transactions
   Triggers
Create user:
mysql> CREATE USER rtg identified by 'password'
    -> ;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[rtg@rtgCent usr]$ mysql -u rtg -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> 
Wednesday, September 17, 2008
MySql basics CentOs 5
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment