Hello,

I am trying to rename database MySQL:

RENAME DATABASE old_db_name TO new_db_name;  

1 kesalahan ditemukan dalam analisis.

A rename operation was expected. (near "" at position 0)

Query SQL:

RENAME DATABASE wwwsoulf_revsoul TO wwwsoulf_revsoul2

MySQL menyatakan: Dokumentasi

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATABASE wwwsoulf_revsoul TO wwwsoulf_revsoul2' at line 1

I wonder why I get an error?

Member Avatar for diafol

RENAME DATABASE was removed as it was deemed "dangerous", whatever that means. I suspect you only need to do this once, so why not let phpMyAdmin or a GUI (SQLyog/Navicat etc) of your choice do it? Simple button click.

Your alternatives (none of which I'd like to do) include:

  • complete DB dump - change the DB name in the sql file and import.
  • copy tables and other copyable entities to new DB and delete old db. Not sure if you can copy triggers and views though.

Use a console - if your db is big, running it through a webpage could timeout and you could be left with a great big mess.

I try that and it over the import limit. How to extend the import limit so that I can import the database information?

I already try to change the upload_max_filesize=4M in php.ini and it does not make any diffference.

"Tidak ada data untuk diimpor. Kemungkinan karena tidak ada berkas yang diambil atau ukuran berkas melebihi ukuran maksimum yang diizinkan oleh konfigurasi PHP Anda. Lihat FAQ 1.16." - Error message in Indonesian

Member Avatar for diafol

Can you not use phpmyadmin? It has an input text field for the new name and a submit button. Couldn't be easier

I finally done it. It's my first time using that rename fitur through the operation. Now, do you know how to pass that size import limit?

Member Avatar for diafol

You have not explained what you are doing. Are we to understand that you have dumped your DB in an sql file, renamed the DB in that and uploaded the modified file?

Of all the options, this was probably one of the most difficult / tedious ones. Why did you not just do this as suggested?

https://www.youtube.com/watch?v=PDjCuFg1Jbg

Renaming a DB should be a very rare operation IMO, so coding a solution doesn't really warrant the time, effort etc. When you have a simple GUI operation like the one shown in the video, it's a no-brainer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.