CyberKeeda In Social Media
Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

FIX : PHPMyAdmin Error - Table 'phpmyadmin.pma_table_uiprefs' doesn't exist



Locate config.inc.php within phpMyAdmin folder.

Find and edit the below mentioned line .


       

$ Cfg ['Servers'] [$ i] ['table_uiprefs'] = ‘pma_table_uiprefs’;

 

Into

       

$ cfg ['Servers'] [$ i] ['pma__table_uiprefs'] = ‘pma__table_uiprefs’;

 
 


       

Finally to apply the changes Restart Apache

 
Read more ...

ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint




Reason - It’s because we have tried to update a table without a WHERE that uses a KEY column.

Fix - The quickest fix is to simply add SET SQL_SAFE_UPDATES=0; before your query 
or execute the query before your truncate query


Use the below mentioned commands within your db to fix it.

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table1;
TRUNCATE table2;
Once records has been removed , revert the changes.
SET FOREIGN_KEY_CHECKS = 1;
Read more ...

Bash - Insert data in mysql table from a file using LOAD DATA LOCAL INFILE command.













As every Linux operator loves text file, a text file is enough to process anything within linux using commands.

Today, we will use the power of BASH to insert data into MYSQL table using LOAD DATA LOCAL INFILE commnad from a local text file.


Here i have some data stored into a file named as myfile.txt

Database name - mydb
Table name      - mytable
filename          - myfile.txt


[root@cyberkeeda ~]# mysql -uYOUR_USERNAME -pYOUR_PASS -D mydb -e "load data local infile '/tmp/myfile.txt' into table mytable fields terminated by ',' lines terminated by '\n'"


Remember for windows based system we have to add  \r  along with \n


#       mysql -uYOUR_USERNAME -pYOUR_PASS -D mydb -e "load data local infile '/tmp/myfile.txt' into table mytable fields terminated by ',' lines terminated by '\r\n'"





Read more ...

FIX - Another MySQL daemon already running with the same unix socket.




To start the MySQL service, you can remove '/var/lib/mysql/mysql.sock' and start the MySQL service again:
  1. Remove the socket file:
    [root@server ~]# rm /var/lib/mysql/mysql.sock
    rm: remove socket `/var/lib/mysql/mysql.sock'? yes
    
  2. Start the MySQL service:
    [root@server~]# service mysqld start
    Starting mysqld:                                           [  OK  ]

Read more ...
Designed By Jackuna