Friday, March 26, 2010

Mysql

Repairing tables
=============

mysqlcheck --all-databases --auto-repair --> it repair all tables

myisamchk -crS /var/lib/mysql/mazad_almazad/*.MYI ---> for misam tables

mysqlcheck -r straysh_/*.frm ---> inodb
=================

Dump database
=======
mysqldump "database_name" > "database_name.sql" like this

root@server [~]# mysqldump indiaond_mmi > indiaond_mmi.sql

Drop
====
mysqladmin drop "database_name" like

mysqladmin drop indiaond_mmi

Create
=======
mysqladmin create "database_name" like

mysqladmin creat indiaond_mmi

Restore
====
mysql "database_name" < "dump path" like

mysql indiaond_mmi < /home/indiaond/indiaond/mysql/indiaond_mmi.sql

Mysql privileges
-------------
Enter in to mysql console

grant all privileges on database_name.* to 'database_username'@'localhost' identified by 'database_password';


mysql> grant all privileges on saudican_monpl2.* to 'saudican_monpl2'@'localhost' identified by 'monpl2';
=======================

The server is not responding (or the local MySQL server's socket is not correctly configured)
-------------------

. You just have to go into the config.inc.php file and change:
$cfg['Servers'][$i]['host'] = 'localhost';

to this

$cfg['Servers'][$i]['host'] = '127.0.0.1';

then save
and re-run [(your directory path]/phpmyadmin/index.php in your browser.
Damned annoying. But I am glad I found the fix now
----------------------------------


Change password through backend
------------------

mysql> select * from agb_book_auth;
+----+----------+-------------------------------------------+----------------------------------+------------+
| ID | username | password | session | last_visit |
+----+----------+-------------------------------------------+----------------------------------+------------+
| 1 | universo | *7ACE763ED393514FE0C162B93996ECD195FFC4F5 | a052734944b5f972db30c2a8f09c3e8d | 1241038315 |
+----+----------+-------------------------------------------+----------------------------------+------------+
1 row in set (0.00 sec)

mysql> update agb_book_auth set password=password('2003love') where username='universo';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from agb_book_auth;
+----+----------+-------------------------------------------+----------------------------------+------------+
| ID | username | password | session | last_visit |
+----+----------+-------------------------------------------+----------------------------------+------------+
| 1 | universo | *EE3B755DE94AD4D46D03BE2E1B6435D3EBA8970A | 712102efbd65e82fa0d789476a6a9382 | 1243574039 |
+----+----------+-------------------------------------------+----------------------------------+------------+
1 row in set (0.00 sec)
-----------------------------------



My.cnf normal standerds
-------
set-variable = max_connections=300
set-variable = max_user_connections=50
set-variable = interactive_timeout=100
set-variable = wait_timeout=100
set-variable = connect_timeout=100
safe-show-database
key_buffer = 384M
max_allowed_packet = 16M
table_cache = 1500
sort_buffer_size = 2M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
old-passwords = 1
----------------

No comments:

Post a Comment