Let’s start by making a new user within the MySQL shell:
mysql>CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; #localhost only
or
mysql>CREATE USER 'newuser'@'%' IDENTIFIED BY 'password'; #any host
mysql>GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; #localhost only
or
mysql>GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%'; #any host
mysql>FLUSH PRIVILEGES;
thanks
Jumat, 01 Mei 2020
Kamis, 13 Februari 2020
#1193 - Unknown system variable 'lc_messages' PhpMyAdmin
Error pada saat login ke MySQL menggunakan phpmyadmin ( [ip server]/phpmyadmin ), dikarenakan versi MySQL lebih rendah daripada PhpMyAdminya, sebagai contoh engine MySQL nya menggunakan versi 5.1.69 sedangkan PhpMyAdminya menggunakan versi 4.6 atau yang lebih tinggi.
biasanya pada saat membuka phpmyadmin lalu login akan muncul error
biasanya pada saat membuka phpmyadmin lalu login akan muncul error
SET lc_messages = 'en_US';
cara mengatasinya adalah sebagai berikut :
Quick fix is easy
- pada file /usr/share/phpmyadmin/libraries/common.inc.php hapus atau tambahkan tanda # baris dibawah ini
if (PMA_MYSQL_INT_VERSION < $cfg['MysqlMinVersion']['internal']) {
PMA_fatalError(
__('You should upgrade to %s %s or later.'),
array('MySQL', $cfg['MysqlMinVersion']['human'])
);
}
dan
- pada file /usr/share/phpmyadmin/libraries/classes/DatabaseInterface.php hapus atau tambahkan tanda # pada baris dibawah ini
if (! empty($locale)) {
$this->query("SET lc_messages = '" . $locale . "';", $link, self::QUERY_STORE);
}
Semoga bermanfaat , salam
Senin, 30 Desember 2019
Create Events from Command Line MySQL
mysql> DROP EVENT `SchGetMobileNeraca` ;
CREATE DEFINER = `root`@`%` EVENT `SchGetMobileNeraca`
ON SCHEDULE EVERY 1 DAY STARTS '2014-01-01 04:00:00'
ON COMPLETION NOT PRESERVE ENABLE
DO CALL GetMobileNeraca();
CREATE DEFINER = `root`@`%` EVENT `SchGetMobileNeraca`
ON SCHEDULE EVERY 1 DAY STARTS '2014-01-01 04:00:00'
ON COMPLETION NOT PRESERVE ENABLE
DO CALL GetMobileNeraca();
Selasa, 10 Desember 2019
Create file service pada Linux Ubuntu
untuk membuat file yang bisa di jalankan menggunakan service pada linux pertama harus membuat file yang di letakan pada directory /sbin/
- sebagai contoh akan melakukan restart service mysql maka terlebih dulu membuat file :
example : rmysql
create file rmysql akan diletakan pada direktori /sbin/ dengan perintah pico
# pico /sbin/rmysql
1. tambahkan perintah didalam file rmysql tersebut sebagai berikut :
#!/bin/sh
sudo /etc/init.d/mysql restart
2. lalu simpan, dan sekarang file /sbin/rmysql sudah berisi command atau perintah untuk melakukan restart mysql
3. agar bisa di jalankan oleh user pada Linux, maka harus di tambahan permissien dengan cara :
#chmod 777 /sbin/rmysql
4. selanjutnya adalah membuat file yang berisi perintah untuk melakukan perintah /sbin/rmysql tersebut
5. file execute tersebut harus di letakan pada direktori /etc/init/ example : mysql_restart
6. create file tersebut dengan command sebagai berikut :
#pico /etc/init/restart_mysql.conf
7. lalu tambahkan perintah didalamnya sebagai berikut :
## restart mysql.conf
start on filesystem
exec /sbin/rmysql
8. lalu simpan, dan sekarang file /etc/init/restart_mysql.conf sudah berisi command perintah untuk melakukan eksekusi file /sbin/rmysql
9. untuk menjalankan file restart_mysql jalankan perintah sebagai berikut :
#service restart_mysql start|restart|stop
Good luck !
- sebagai contoh akan melakukan restart service mysql maka terlebih dulu membuat file :
example : rmysql
create file rmysql akan diletakan pada direktori /sbin/ dengan perintah pico
# pico /sbin/rmysql
1. tambahkan perintah didalam file rmysql tersebut sebagai berikut :
#!/bin/sh
sudo /etc/init.d/mysql restart
2. lalu simpan, dan sekarang file /sbin/rmysql sudah berisi command atau perintah untuk melakukan restart mysql
3. agar bisa di jalankan oleh user pada Linux, maka harus di tambahan permissien dengan cara :
#chmod 777 /sbin/rmysql
4. selanjutnya adalah membuat file yang berisi perintah untuk melakukan perintah /sbin/rmysql tersebut
5. file execute tersebut harus di letakan pada direktori /etc/init/ example : mysql_restart
6. create file tersebut dengan command sebagai berikut :
#pico /etc/init/restart_mysql.conf
7. lalu tambahkan perintah didalamnya sebagai berikut :
## restart mysql.conf
start on filesystem
exec /sbin/rmysql
8. lalu simpan, dan sekarang file /etc/init/restart_mysql.conf sudah berisi command perintah untuk melakukan eksekusi file /sbin/rmysql
9. untuk menjalankan file restart_mysql jalankan perintah sebagai berikut :
#service restart_mysql start|restart|stop
- start : untuk menjalankan serrvice mysql
- restart : untuk mematikan dan menjalankan ulang service mysql
- stop : untuk mematikan service mysql
Good luck !
Kamis, 11 Juli 2019
Linux Redirect Error Output To File
I am a new Ubuntu Linux and bash shell user. I also know how to redirect output from display/screen to a file using the following
syntax:
cmd > file
ls > file
However, some time errors are displayed on screen. How do I store and redirect output from the computer screen to a file on a Linux or Unix-like systems?
[donotprint][/donotprint] Bash / ksh and other modern shell on Linux has three file descriptors:
Another usage:
OR
syntax:
cmd > file
ls > file
However, some time errors are displayed on screen. How do I store and redirect output from the computer screen to a file on a Linux or Unix-like systems?
[donotprint][/donotprint] Bash / ksh and other modern shell on Linux has three file descriptors:
- stdin (0)
- stdout (1)
- stderr (2)
Syntax To redirect all output to file
The syntax is as follows to redirect output (stdout) as follows:command-name > output.txt command-name > stdout.txt |
Syntax To redirect all error to file
The syntax is as follows to redirect errors (stderr) as follows:command-name 2> errors.txt command-name 2> stderr.txt |
Syntax to redirect both output (stdout) and errors (stderr) to different files
The syntax:command1 > out.txt 2> err.txt command2 -f -z -y > out.txt 2> err.txt |
Syntax to redirect both output (stdout) and errors (stderr) to same file
The syntax is:command1 > everything.txt 2>&1 command1 -arg > everything.txt 2>&1 |
Syntax to redirect errors (stderr) to null or zero devices
Data written to a null or zero special file is discarded by your system. This is useful to silence out errors (also know as ‘error spam’):command1 2> /dev/null command1 2> /dev/zero command2 -arg 2> /dev/null command2 -arg 2> /dev/zero |
Tip: Use tee command to redirect to both a file and the screen same time
The syntax is:command1 |& tee log.txt ## or ## command1 -arg |& tee log.txt ## or ## command1 2>&1 | tee log.txt |
#!/bin/bash # My script to do blah ... foo(){ : } 2>&1 | tee foo.log |
#!/bin/bash # My script to do blah ... { command1 command2 } 2>&1 | tee script.log https://www.cyberciti.biz/faq/linux-redirect-error-output-to-file/ |
Kamis, 20 Juni 2019
Howto resolve mysql error code1548 cannot load from mysql proc the table isprobably corrupted
MySQL will sometimes return the error message “Cannot load from
mysql.proc. The table is probably corrupted”. This happens due to schema
changes required for different MySQL server versions. The simple fix to
this problem is to run the mysql_upgrade command from the command line.
About mysql_upgrade
mysql_upgrade examines all tables across all databases for
incompatibilities with the current version of MySQL Server.
mysql_upgrade also upgrades the system tables so that you can take
advantage of new privileges or capabilities that might have been added.
mysql_upgrade should be executed each time you upgrade MySQL. It
supersedes the older mysql_fix_privilege_tables script, which should no
longer be used.
mysql_upgrade executes the following commands to check and repair tables and to upgrade the system tables:
mysqlcheck --all-databases --check-upgrade --auto-repair
mysql < fix_priv_tablesRun mysql_upgrade From Command Line
To use mysql_upgrade, make sure your MySQL server is running and then invoke mysql_upgrade from the command line tool:mysql_upgrade -uroot -p --force
You should then be prompted to enter the MySQL root's password and
mysql_upgrade will check all the databases and tables and fix them where
appropriate. You may need to specify the full path to the above command
if it's not in the shell's search path.
On Debian 6 it should be loacted at:
/usr/bin/mysql_upgrade -uroot -p --force
On Mac's MAMP the default path is: /Applications/MAMP/Library/bin/mysql_upgrade -uroot -p --force
On Windows it'll be where MySQL is installed and contained in the bin subdirectory. By default it should be located at:"C:\Program Files\MySQL\MySQL Server\[*CHANGE TO MySQL SERVER*]\bin\mysqladmin" -u root shutdownVICTORY!
After running mysql_upgrade, stop the server and restart it so that
any changes made to the system tables are ensured to take effect.
All checked and repaired tables are marked with the current MySQL
version number. This ensures that next time you run mysql_upgrade with
the same version of the server, it can tell whether there is any need to
check or repair the table again.
http://www.myguysolutions.com/2013/10/30/how-to-resolve-mysql-error-code-1548-cannot-load-from-mysql-proc-the-table-is-probably-corrupted/
Selasa, 15 Januari 2019
Auto Mount Hardisk di Linux
Cara gampang untuk mount partisi di Linux adalah dengan memanfaatkan
fstab, bila sudah ditambahakan di fstab setiap booting/reboot hardisk akan otomatis di mount
Jalankan
blkid/dev/sda1: LABEL="DATA" UUID="0cf51519-1b17-4861-8ca7-bbe119d6eac0" TYPE="ext4" PARTUUID="424fc3ac-b216-4f38-b144-6cd4f96c711e" /dev/sdb1: SEC_TYPE="msdos" UUID="3E16-5919" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="62fbb27f-8970-46d6-99d3-a1d1d04a12311" /dev/sdb2: UUID="3ee658e4-4f2c-42g9-9a9d-2f778ed5c87b" TYPE="ext4" PARTUUID="36c3fe5a-85c8-4f04-aaa8-a2ua60b4eywf0" /dev/sdb3: UUID="gh21-h-kJLK-dd-dVzC-g0HQ-rws" TYPE="LVM2_member" PARTUUID="605tda7a-b1a1-4w2a-889f-d1da62bf3891" |
Yang akan di mount otomatis adalah
buka file /etc/fstab tambahkan
/dev/sda1buka file /etc/fstab tambahkan
Partisi EXT4
UUID="0cf51519-1b17-4861-8ca7-bbe119d6eac0" /media/Film ext4 defaults 0 0 |
Partisi NTFS
UUID="0cf51519-1b17-4861-8ca7-bbe119d6eac0" /media/Film ntfs-3g defaults,locale=en_US.UTF-8 0 0 |
buat folder /media/Film sebagai tempat mount partisi tersebut.
mkdir /media/Film |
dengan menambahkan baris diatas di fstab maka hardisk yang di mount sewaktu booting bisa dibaca/tulis (read/write) oleh user.
Langganan:
Postingan (Atom)