UPDATE MyTable
SET StringColumn = REPLACE (StringColumn, 'SearchForThis', 'ReplaceWithThis')
WHERE SomeOtherColumn LIKE '%PATTERN%'
Category Archives: mysql
mtsql schedule backup
crontab -e
0 22 * * * mysqldump -udbuser -ppassword dbname > /home/backup/dbname_`date +”%d-%m-%Y”`.sql
Reset a MySQL root password
Stop the MySQL service
(Ubuntu and Debian) Run the following command:
sudo /etc/init.d/mysql stop
(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following command:
sudo /etc/init.d/mysqld stop
Start MySQL without a password
Run the following command. The ampersand (&) at the end of the command is required.
sudo mysqld_safe --skip-grant-tables &
Connect to MySQL
Run the following command:
mysql -uroot
Set a new MySQL root password
Run the following command:
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
Stop and start the MySQL service
(Ubuntu and Debian) Run the following commands:
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following commands:
sudo /etc/init.d/mysqld stop
sudo /etc/init.d/mysqld start
allow root access in phpmyadmin
skip Configuring phpmyadmin in installation steps
login to mysql
mysql -u root -p mysql
write this mysql command
update user set plugin='' where user='root';
flush privileges;
exit
systemctl restart apache2
copy data from one column to another in the same table
Incorrect integer value: ” for column ‘col_name’
to resove this error
you need to update my.ini by
Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
or run this in sql editor
SET @@global.sql_mode= '';
Back Up and Restore a MySQL Database
How to make Mysql database to support Arabic Language?
to insert and retrieve arabic text in Mysql using PHP
add mysql_set_charset('utf8');
after
mysql_connect(“localhost”, “user”, “password”) or die(mysql_error());