Reinstall Steps

I deployed a nextcloud installation within a VM but would like to reinstall with the data folder set to a folder shared with the host. Also, while configuring my nginx and phpmyadmin installations I have messed something up with permissions. I can view the frontend of Nextcloud, but can’t really view or upload any files.

I installed on a CentOS 7 VM using MariaDB and NGINX.

What steps need to be taken for a clean reinstall so that I can remedy these problems?

If you want to start at zero, you can delete the config.php and the existing data-folder. When you call the Nextcloud URL in your browser again, you get the install screen again. You can as well use the occ-command to do the install directly from your commandline passing all the required settings.

1 Like

This almost worked for me.

I had errors saying username already in use.

Had to

mysql -u root -p


use mynextclouddb


DROP TABLE oc_accounts, oc_activity, oc_activity_mq, oc_addressbookchanges, oc_addressbooks, oc_admin_sections, oc_admin_settings, oc_appconfig, oc_authtoken, oc_bruteforce_attempts, oc_calendarchanges, oc_calendarobjects, oc_calendarobjects_props, oc_calendars, oc_calendarsubscriptions, oc_cards, oc_cards_properties, oc_comments, oc_comments_read_markers, oc_credentials, oc_dav_shares, oc_federated_reshares, oc_file_locks, oc_filecache, oc_files_trash, oc_flow_checks, oc_flow_operations, oc_group_admin, oc_group_user, oc_groups, oc_jobs, oc_mimetypes, oc_mounts, oc_notifications, oc_notifications_pushtokens, oc_oauth2_access_tokens, oc_oauth2_clients, oc_preferences, oc_privatedata, oc_properties, oc_schedulingobjects, oc_share, oc_share_external, oc_storages, oc_systemtag, oc_systemtag_group, oc_systemtag_object_mapping, oc_trusted_servers, oc_twofactor_backupcodes, oc_users, oc_vcategory, oc_vcategory_to_object;

BINGO… Back in from the begining !

1 Like


I found this thread a couple of years later and just wanted to add to this for a more complete answer.

To re-install you should:

  • Stop the web server

  • delete or rename the config.php file sitting in the <directory>/nextcloud/config directory

  • delete or rename your data directory, that is <directory>/nextcloud/data

  • drop all the tables in your database. Use something like:

    mysql -u root -p
    > use nextcloud;
    > SELECT concat("DROP TABLE IF EXISTS ", table_name, ";")
    -> FROM information_schema.tables WHERE table_schema = "nextcloud";

to generate a list of SQL statements you need to drop all the tables. Cut and paste back into the SQL cli

  • Finally, go back to the <directory>/nextcloud/config directory and create a new file CAN_INSTALL using something like this:

    cd /var/www/nextcloud/config
    touch CAN_INSTALL
    chown www-data CAN_INSTALL
    chgrp www-data CAN_INSTALL
    chmod 644 CAN_INSTALL

  • Restart the web server

1 Like

So actually, as in my case, it is better to do the format and put the server up again. 99% of errors of this type are unrecoverable in such free projects.

This did the trick for me. Thank you